First-Program

Run Settings
LanguagePython
Language Version
Run Command
# operator precedence # print(20 - 3 * 4) # () # ** # * / # + - # Guess the output of each answer before you click RUN # Try to write down your answer before and see how you do... keep it mind I made it a little tricky for you :) # print((5 + 4) * 10 / 2) # 45 # # print(((5 + 4) * 10) / 2) # 45 # # print((5 + 4) * (10 / 2)) # 45 # # print(5 + (4 * 10) / 2) # 25 # # print(5 + 4 * 10 // 2) # 25 # # Optional: bin() and complex #print(bin(5)) #print(int('0b101', 2)) ## variables # Data types in Python # int # float # bool # sets # dict # str # tuple # list # complex # user_iq = 190 # user_age = user_iq/4 # a = user_age # # print(a) # # # constants # PI = 3.14 # a,b,c = 1,2,3 # # print(PI) # print(a) # print(b) # print(c) # Expressions vs statements #iq = 100 #user_age = iq / 5 # expression is iq/5 and statement is user_age = iq / 5 # augmented assigment operator #some_value = 5 #some_value *= 2 # #print(some_value) # strings #print(type("hello there 42 MUkwaxi")) #username = 'supercoder' #password = 'supersecret' # # #long_string = ''' #WOW #0 0 #--- # #''' # #print(long_string) # # #first_name = 'Marcio' #last_name = 'Jeovety' #full_name = first_name + ' ' + last_name #print(full_name) # string concatenation #print('hello' + ' Marcio') #print('hello' + 5) #type conversion #print(type(str(100))) # escape sequence #weather = '\nIt\'s \"kind of\" sunny' # #print(weather) # formatted strings #name = 'Johnny' #age = 55 #print(f'hi {name}. You are {age} years old') # String indexes #selfish = '01234567' #print(selfish[::-1]) # Immutability #selfish = '01234567' # #selfish = 100 # #print(selfish) #Built-in functions + methods # quote = 'to be or not to be' # # print(quote.upper()) # # print(quote.capitalize()) # # print(quote.lower()) # # print(quote.find('be')) # # print(quote.replace('be', 'me')) # # print(quote) # Booleans #name = 'Marcio' #is_cool = False # #is_cool = True # #print(is_cool) #print(bool(1)) # Exercise Type conversion #name = 'Marcio Jeovety' #age = 150 #relationship_status = 'single' # # #relationship_status = f'It is fire with Katy' # #print(relationship_status) #birth_year = input('what year were you born?\n') # #print('So you are ' + str(2026 - int(birth_year)) + ' years old.') #print(bool(5)) # Exercise Password checker #username = input('what is your name?\n') #password = input('what is your password?\n') # #password_length = len(password) #hidden_password = '*' * password_length # #print(f'Hello {username}, your password {hidden_password} is {password_length} letters long.') # Lists #List slicing #amazon_cart = [ # 'notebooks', # 'sunglasses', # 'toys', # 'grapes' #] # # #amazon_cart[0] = 'macbook' #new_cart = amazon_cart[:] #new_cart[0] = 'windows' # #print(new_cart) #print(amazon_cart) # Matrix #matrix = [ # [1,2,3], # [2,4,6], # [7,8,9] #] # #print(matrix[0][1]) # List methods basket = ['m','a', 'k','b', 'c','z', 'd', 'e'] # adding #new_list = basket.append(100) #basket.insert(4, 20) #new_list = basket # #print(basket) #print(new_list) # removing #basket.pop() #basket.pop(0) #basket.remove(4) #basket.clear() # index #print(basket.index('b', 0, 3)) #print('d' in basket) #print(basket.count('d')) #basket.sort() #basket.reverse() #basket.sort() #basket.reverse() # # # #new_sentence = ' '.join(['hi', 'my', 'name', 'is', 'DoDo']) # #print(basket[::-1]) #print(basket) # #print(list(range(11))) #print(new_sentence) # list unpacking #a,b,c, *other = [1,2,3,4,5,6,7,8,9] #print(other) # None is absence of value #weapons = None #print(weapons) # dictionary #dictionary = { # 'a' : [1,2,3], # 'b' : 'hello', # 'x' : True #} #my_list = [{ # 'a' : [1,2,3], # 'b' : 'hello', # 'x' : True # }, # { # 'a' : [4,5,6], # 'b' : 'hello', # 'x' : True # } #] # #print(my_list[0]['a'][2]) #print(my_list[1]['a'][1]) user = { 'basket' : [1,2,3], 'greet' : 'hello', 'x' : True, 'age' : 20 } #user2 = dict(name='Jon Jones') #print(user.get('age', 0)) #print('basket' in user) #print('age' in user.keys()) #print(user.items()) #user2 = user.copy() #print(user.update({'age': 55})) #print(user)
Editor Settings
Theme
Key bindings
Full width
Lines