PYTHON
SELECTION
OBJECTIVES
Challenge
- Understand how to program Selection in Python
Super Challenge
- Apply your understanding to your own game
STARTER
In your book write down what decisions your program will need to make. Make sure you focus on the decisions your program will need to make, rather than the person playing the game.
PRACTICE MAKING DECISIONS
Go to page 38 in the Red Python book. It explains about using IF, ELIF and ELSE
What do you think the OUTPUT of this code would be if the INPUT was Cheese
IF SocksSmell="flowers"
PRINT("wear them")
ELIF SocksSmell = "Earthy"
PRINT ("Turn them inside out , they're good to go")
ELSE SockSmell = "Cheese"
PRINT("Time to wash")
PRACTICAL TASKS
Have a go at making your own Magic 8 Ball - You can put in any answers you like! Open Python and go to Page 40 of the Red book and have a go at using the code in the book.
Don't forget to press F5 to see it works
SUPER CHALLENGE
Add some code so:
The program starts by saying 'hi' and then asks the user their name
It should then store the Variable user_name
Change the rest of the code so that it shows the user's name in the answers e.g."hello", name, "what question do you have?"
Can you apply it?
Revisit your books and using a GREEN pen write an example in code of the questions you might need to code for your game
SELECTION
OBJECTIVES
Challenge
- Understand how to program Selection in Python
Super Challenge
- Apply your understanding to your own game
STARTER
In your book write down what decisions your program will need to make. Make sure you focus on the decisions your program will need to make, rather than the person playing the game.
PRACTICE MAKING DECISIONS
Go to page 38 in the Red Python book. It explains about using IF, ELIF and ELSE
What do you think the OUTPUT of this code would be if the INPUT was Cheese
IF SocksSmell="flowers"
PRINT("wear them")
ELIF SocksSmell = "Earthy"
PRINT ("Turn them inside out , they're good to go")
ELSE SockSmell = "Cheese"
PRINT("Time to wash")
PRACTICAL TASKS
Have a go at making your own Magic 8 Ball - You can put in any answers you like! Open Python and go to Page 40 of the Red book and have a go at using the code in the book.
Don't forget to press F5 to see it works
SUPER CHALLENGE
Add some code so:
The program starts by saying 'hi' and then asks the user their name
It should then store the Variable user_name
Change the rest of the code so that it shows the user's name in the answers e.g."hello", name, "what question do you have?"
Can you apply it?
Revisit your books and using a GREEN pen write an example in code of the questions you might need to code for your game