Technology for Learners | Learn to use Technology and use ...
WALT: Use input statements in PythonPython has statements that can be used to accept an input of data from the user.Class demonstrationStep 1: Open the Python Shell. Select File New File Save As call the file statements.py.Step 2: Write the following code into the Editor. Then click Run Run Module. What do students think this program will do when it is run? Explain that we are declaring a variable called ‘name’ but instead of assigning it a value, we use the input() statement which allows us to write a question to the user.Step 3: To make this more interesting, we can also add the if and else statements:Step 4: Discuss with the students how they think this will change the program. Re-run the program and see. Step 5: Explain that we will now use user inputs make a program, which calculates the total number of exercise book required for a class of students. Independent work:Coding challenge 1: Write a program that asks the user to enter how many children are in their class and how many exercise books each child has. The program should then output how many exercise books there are altogether. Coding challenge 2: Write a program which asks the user their name and how many days until their next birthday. The program should then output a personalised sentence with a rough approximation of the number of seconds until their next birthday. Clue: ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- when to use i and me correctly
- how to use than and then
- when to use me and someone
- how to use technology in the classroom
- when to use have and has correctly
- how to use your and you re
- when to use then and than
- when to use been and being
- how to use have and has
- when to use has and have grammar
- when to use have and has
- how to use i and me correctly