Wednesday, April 30, 2014

Day 25

Explored some Python at Gork Learning. Worked on, Hour of Code: The Dark Tunnel – adventure game! Learned to use the if and else functions to print out a predetermined response based on what the player chooses to do.

The code I used:
print("What action would you like to do?")
guess = input("> ")
if guess == "look":
print("You look around.")
else:
print("You cannot do that.")

The interactions looked like this:
What action would you like to do?
> look
You look around.

What action would you like to do?
> run
You cannot do that.

Tuesday, April 29, 2014

Day 24

Explored some Python at Gork Learning. Worked on, Hour of Code: The Dark Tunnel – adventure game! Learned to use the if function to print out a predetermined action based on what the player chooses to do.

The code I used:
print("You are standing in the middle of the tunnel.")
print("Where would you like to go?")
action = input("> ")
if action == "forward":
print("You move further into the tunnel.")
if action == "backward":
print("You move back towards the tunnel entrance.")

The interactions looked like this:
You are standing in the middle of the tunnel.
Where would you like to go?
> forward
You move further into the tunnel.

You are standing in the middle of the tunnel.
Where would you like to go?
> backward
You move back towards the tunnel entrance.

Monday, April 28, 2014

Day 23

Explored some Python at Gork Learning. Worked on, Hour of Code: The Dark Tunnel – adventure game! Learned to use the print and input functions to print out an action the player has chosen to do after they type it in.

The code I used:
print("What action would you like to do? ")
action = input("> ")
print("You", action, “around.”)

The interactions looked like this:
What action would you like to do?
> look
You look around

What action would you like to do?
> jump
You jump around

What action would you like to do?
> run
You run around

Sunday, April 27, 2014

Day 22

Explored some Python at Gork Learning. Worked on, Hour of Code: The Dark Tunnel – adventure game! Learned to print the games title.

The code I used:
print('The Dark Tunnel')

The interaction looked like this:
The Dark Tunnel

Saturday, April 26, 2014

Day 21

Explored some Python at Gork Learning. Worked on, Hour of Code: Disease Epidemic! The curious case of the glowing nose. Learned to write a program that prints out how many tablets to give to each cat based on how much their nose is glowing.

The code I used:
lum = int(input("Luminosity?"))
if lum < 1:
print("No tablets")
if lum == 1:
print("1 tablet")
if lum > 1:
print("2 tablets")

The interaction looked like this:
Luminosity?0
No tablets

Luminosity?1
1 tablet

Luminosity?2
2 tablets

Friday, April 25, 2014

Day 20

Explored some Python at Gork Learning. Worked on, Hour of Code: Disease Epidemic! The curious case of the glowing nose. Learned to write a program that reads in the number of cats in your town, and how many cats are already glowing, and prints out whether all the cats are now glowing or not.

The code I used:
cat = int(input("Estimated total cats? "))
catglow = int(input("How many cats are glowing? "))
if cat > catglow:
print("Not all the cats are glowing.")
else:
print("All the cats are glowing.")

The interaction looked like this:
Estimated total cats? 100
How many cats are glowing? 50
Not all the cats are glowing.

Thursday, April 24, 2014

Day 19

Explored some Python at Gork Learning. Worked on, Hour of Code: Disease Epidemic! The curious case of the glowing nose. Learned to write a program that reads in how many cats are infected now, and prints out how many cats will be infected in an hour.

The code I used:
cat = int(input("Cats infected? "))
cat_hour = cat * 3
print("Cats infected in an hour", cat_hour, )

The interaction looked like this:
Cats infected? 3
Cats infected in an hour 9