Python course · Chapter 4

Input and output

input(), converting text to numbers, f-strings.

Project: a silly-story maker.

  1. 4.1Asking questionsinput() lets your program ask a question and use the answer.5 steps · about 20 minutes · 0 of 3 challenges passedStart →
  2. 4.2Turning text into numbersinput() always gives text. int() and float() turn it into a number you can do maths with.7 steps · about 20 minutes · 0 of 3 challenges passedOpen →
  3. 4.3f-stringsDrop variables straight into text, with full control over spaces and decimal places.7 steps · about 20 minutes · 0 of 3 challenges passedOpen →
  4. 4.4Tidy outputTake charge of print(): what goes between the pieces, what goes at the end, and new lines inside text.6 steps · about 20 minutes · 0 of 3 challenges passedOpen →
  5. 4.5Project: silly-story makerPut the chapter together: ask for words and a number, then build a story around them.4 steps · about 15 minutes · 0 of 2 challenges passedOpen →
  6. CheckCheckpointFive mixed questions on input and output, with maths and variables mixed back in. Pass them all to finish the chapter.1 steps · about 15 minutes · 0 of 5 challenges passedOpen →