"""First Steps""" # a = 1 # b = 2 # print (a+b) # if command # age = 30 # if age > 40: # print ('You are so old') # else: # print ('Wow!') # print('This will be printed anyway') # Loops # contributions = [1,2, 4, 1, 4] # print(sum(contributions)) # for i in contributions: # print(i) # print (f'Your conrtibution is: {i} and payoff is {i*2}') # print (contributions [0:2]) # contributions = [1, 3, 5, 33, 44, 6, 77, 89] # new_list = [i**2 for i in contributions if i % 2 == 0] # POWER: i**2 # print(new_list) # Sum up the strings of the list # print(sum(new_list)) # myinfo = {'name':'Nils', #'citizenship': 'German', #'Work': 'Uni Goettingen', #'contribution': [1, 2, 3, 3], #'wife': {'name': 'Franzy'}} # print(myinfo['name']) # print(myinfo.get ('income', 1234)) # for k,v in myinfo.items(): # print(f'Your {k} is {v}') '''More complicated structure''' #incomes = [100, 200, 300, 4099, ] #def income_after_tax (income): # tax_rate = 0.2 #return round (income * (1 - tax_rate), 2) #for i in incomes: # print(f'your income after tax is {income_after_tax(i)}') #a = False #if not a: # print('OUCH!') #answer = 'No' #possible_nos = ['Nope', 'No', 'Nehhh', 'Nein', 'Nyet'] #if answer in possible_nos: # print('Noooo!') # record = False #else: # record = True class Person: nation = 'German' name = 'Nils' height = 187 weight = 90 def get_bmi(self): return (self.height / 100) / self.weight **2 ph = Person() print(ph.nation) print(ph.get_bmi())