Marco! Polo!


First task of week two, introduced the function if . This allowed me to program, so that when you ask question and reply, you get an appropriate answer.  eg. 
raining = input("Is it raining (yes/no)? ")
if raining == "yes":
  print("You should take the bus to work.")
if raining == "no":
  print("You should walk to work.")

When writing this program, it was frustrating because grok is very sensitive to indentations and if the indentations is off by one or two, the whole program doesn't work or has an error. 

Marco! Polo!- The program used input of the text, Marco,and the  if function that required it to reply with polo. The second part of this task wanted me to program so that it would say nothing if anything else was entered. I wasn't sure about how to program that but I resulted to put it in a if function with empty quotations, which gave me  the result I needed. 

No comments:

Post a Comment