Friday, May 2, 2014

Day 27

Explored some Python at Gork Learning. Worked on, Hour of Code: The Dark Tunnel – adventure game! Learned to use the while function to repeat things while a particular condition is true.

The code I used:
command = input("Enter a command: ")
while command != "quit":
print("Your command was:", command)
command = input('Enter a command: ')

The interaction looked like this:
Enter a command: look
Your command was: look
Enter a command: forward
Your command was: forward
Enter a command: quit

No comments:

Post a Comment