Input to the Rescue
Explore how to use Python's input() function to capture user input and the len() function to count characters in a string. This lesson helps you create interactive programs by accepting user responses and measuring text length, useful for applications like games or writing tools.
We'll cover the following...
To maneuver around in Edward's world, he has to unlock a block before he can move forward or backward. Walk Edward to the yellow block and see what happens.
Answering Edward’s riddle
Edward can’t move past the yellow block unless he answers the question correctly. But Edward doesn't know what the answer is. Can you solve the question?
We can help Edward by inputting the correct answer. Go ahead and enter the answer to help Edward reach the green block.
Input in Python
Communication is a two-way street. Just like we had print() in one direction, where the computer’s code can print something on the screen for the end user, we should have a mechanism where the computer code can receive something from the user through a keyboard. For instance, there could be a need to input a value or text in a computer program to work. A calculator program might prompt ...