Reading Input
7 min · Python
Make your program read the numbers and text it is given, instead of typing them into the code.
Python · Reading Input0/5 cleared
Enemy 1 of 5
This program reads one line with input() and stores it in name, then prints a greeting with it. Press Run to see it greet the name in the Input box.
Why this works
So far every value in your programs was typed straight into the code. Real problems do not work that way. A problem hands your program some input, and your program has to read it.
In Python you read one line of input with input(). It gives the line back to you as text, and you store it in a variable like any other value.
The Input box under this text holds the line your program will receive. Press Run and the program greets whoever is in the input.
You
Cold-Start Frostling
Input your program receives
Ada
Loading editor…
Target output: Hello, Ada