Python course · Chapter 4
Input and output
input(), converting text to numbers, f-strings.
Project: a silly-story maker.
- 4.1Asking questionsinput() lets your program ask a question and use the answer.Start →
- 4.2Turning text into numbersinput() always gives text. int() and float() turn it into a number you can do maths with.Open →
- 4.3f-stringsDrop variables straight into text, with full control over spaces and decimal places.Open →
- 4.4Tidy outputTake charge of print(): what goes between the pieces, what goes at the end, and new lines inside text.Open →
- 4.5Project: silly-story makerPut the chapter together: ask for words and a number, then build a story around them.Open →
- CheckCheckpointFive mixed questions on input and output, with maths and variables mixed back in. Pass them all to finish the chapter.Open →