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.
Wednesday, April 30, 2014
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.
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
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
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
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 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.
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:
The interaction looked like this:
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
Wednesday, April 23, 2014
Day 18
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 to read in suggested names and print them out.
The code I used:
The interaction looked like this:
The code I used:
name = input("Hi kitty what is your name? ")
print("Meow", name)
The interaction looked like this:
Hi kitty what is your name? Esa
Meow Esa
Tuesday, April 22, 2014
Day 17
Explored some Python at Gork Learning, wrote a program in which bot asks are we there yet, then reacts based on your comment, added an if statement..
The code I used:
# Code for "Interacting with bot."
The interaction looked like this:
The code I used:
# Code for "Interacting with bot."
answer = "no"
while answer != "yes":
if answer == "nearly":
print("Yay!")
print("Are we there yet?")
answer = input()
print("Yes! We are finally here.")
The interaction looked like this:
Are we there yet?
no
Are we there yet?
nearly
Yay!
Are we there yet?
nope
Are we there yet?
yes
Yes! We are finally here.
Monday, April 21, 2014
Day 16
Explored some Python at Gork Learning, wrote a program in which bot asks are we there yet, then reacts based on your comment.
The code I used:
# Code for "Interacting with bot."
The interaction looked like this:
The code I used:
# Code for "Interacting with bot."
answer = "no"
while answer != "yes":
print("Are we there yet?")
answer = input()
print("Yes! We are finally here.")
The interaction looked like this:
Are we there yet?
no
Are we there yet?
no
Are we there yet?
yes
Yes! We are finally here.
Sunday, April 20, 2014
Day 15
Explored some Python at Gork Learning, wrote a program in which bot asks how are you feeling, then reacts based on your comment.
The code I used:
# Code for "Interacting with bot."
The interaction looked like this:
The code I used:
# Code for "Interacting with bot."
print("How are you feeling today?")
feeling = input()
if feeling == "Good":
print("That's good.")
elif feeling == "Awesome":
print("You are awesome!")
elif feeling == "Sad":
print("Maybe I can help?")
else:
print("I'm sorry you feel like that.")
How are you feeling today?
sad
I'm sorry you feel like that
Saturday, April 19, 2014
Day 14
Explored some Python at Gork Learning, wrote a program in which bot asks what your favorite movie is, then compliments you on your excellent taste.
The code I used:
The interaction looked like this:
The code I used:
# Code for "Interacting with bot."
print("So what is your favorite movie?")
movie = input()
print("Great! I love " + movie + " too.")
The interaction looked like this:
So what is your favorite movie?
Harry Potter
Great! I love Harry Potter too.
Friday, April 18, 2014
Wednesday, April 16, 2014
Day 11
Played around with changing some code instructions and seeing how it affects the outcome. Completed all 6 puzzles on Stage 19 and finished up the rest of the tutorials. In total I have completed over 1000 lines of code. This was the last lines of code I wrote today.
var depth;
var branches;
function draw_a_tree(depth, branches) {
if (depth > 0) {
penColour(colour_random());
penDown();
moveForward(7 * depth);
turnLeft(130);
for (var count = 0; count < branches; count++) {
turnRight(180 / branches);
draw_a_tree(depth - 1, branches);
}
turnLeft(50);
penUp();
moveBackward(7 * depth);
}
Tuesday, April 15, 2014
Day 10
Learned about Functions and did some debugging . Completed all 9 puzzles on Stage 17. This was the last lines of code I wrote today
var counter;
var height;
function remove_pile(height) {
for (var count = 0; count < counter; count++) {
dig();
}
}
for (counter = 1; counter <= 6; counter++) {
remove_pile(counter);
moveForward();
}
Monday, April 14, 2014
Day 9
Learned about Variables and Functions. Completed all 10 puzzles on Stage 15. This was the last lines of code I wrote today.
var length2;
var counter;
function draw_a_square(length2) {
for (var count = 0; count < 4; count++) {
moveForward(length2);
turnRight(90);
}
}
function draw_a_triangle(length2) {
for (var count2 = 0; count2 < 3; count2++) {
moveForward(length2);
turnRight(120);
}
}
Sunday, April 13, 2014
Day 8
Learned about "if else" commands and Functions. Completed all 10 puzzles on Stage 13. This was the last lines of code I wrote today.
function fill_stack_of_2_holes() {
turnLeft();
for (var count = 0; count < 2; count++) {
fill();
moveForward();
}
turnRight();
turnRight();
for (var count2 = 0; count2 < 2; count2++) {
moveForward();
}
turnLeft();
}
Saturday, April 12, 2014
Day 7
Learned about the counter and moveForward commands. Completed all 11 puzzles on Stage 11. This was the last lines of code I wrote today.
var counter;
penWidth(2);
for (counter = 1; counter <= 250; counter += 2) {
moveForward(counter);
turnRight(91);
penColour(colour_random());
}
Friday, April 11, 2014
Day 6
Completed all 11 puzzles on Stage 8. This was the last lines of code I wrote today.
while (isPathForward()) {
moveForward();
if (pilePresent()) {
dig();
}
if (holePresent()) {
fill();
}
}
Thursday, April 10, 2014
Day 5
Completed all 11 puzzles on Stage 7. This was the last lines of code I wrote today.
for (var count3 = 0; count3 < 12; count3++) {
for (var count2 = 0; count2 < 3; count2++) {
penColour(colour_random());
for (var count = 0; count < 4; count++) {
moveForward(20);
turnRight(90);
}
moveForward(20);
}
turnRight(30);
}
Wednesday, April 9, 2014
Day 4
for (var count = 0; count < 12; count++) {
penColour(colour_random());
turnRight(45);
penWidth(8);
moveForward(100);
turnRight(120);
moveForward(200);
turnRight(120);
moveForward(200);
turnRight(120);
moveForward(125);
}
Tuesday, April 8, 2014
Day 3
Learned about loops, if and else statements. Have written
around 100 lines of code so far and completed puzzles 2 – 20. This was the last
lines of code I wrote today.
while (notFinished()) {
if (isPathForward()) {
moveForward();
} else {
if (isPathRight()) {
turnRight();
} else {
turnLeft();
}
}
}
Monday, April 7, 2014
Day 2
Surfed the internet looking for free ways to learn coding. Decided to give code.org a try. I completed puzzle 1 using block based code with these 2 lines of code.
moveForward();
moveForward();
Sunday, April 6, 2014
Subscribe to:
Posts (Atom)