Programming basics · GCSE · OCR J277 2.2.1, AQA 8525 3.2.7, Edexcel 1CP2 6.4.1 · about 12 min
Asking questions with input(), and why every answer is text.
[1 mark]What does the program do when it reaches name = input("Name? ")?
[1 mark]The user types 20 at far = input("How far? "). What is stored in far?
[1 mark]What does this program print?
far = "20" print(far * 3)
[1 mark]Why leave a space at the end of the prompt, as in input("Name? ")?
[1 mark]Which of these are inputs to a program?
Tick every answer that is true.
Ask What is your name? , then print Hello <name>, I am BugBot using the answer, and turn the LED green. The task will answer Ada, but your program must work for any name, so do not type Ada into it.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() name = ...
Plan your program here, then type it in and press Run.
*.input give back?