Posts

Showing posts with the label if else

Comparator, if else, for loop

Image
  If else syntax # if statement for area if area > 15:     print("big place!") # if-else construct for room if room == "kit" :     print("looking around in the kitchen.") else :     print("looking around elsewhere.") # if-elif-else construct for area if area > 15 :     print("big place!") elif area >10:     print("medium size, nice!") else :     print("pretty small.") # Definition of dictionary europe = {'spain':'madrid', 'france':'paris', 'germany':'berlin',           'norway':'oslo', 'italy':'rome', 'poland':'warsaw', 'austria':'vienna' }            # Iterate over europe for key, value in europe.items():     print("the capital of "+key+" is "+value)