Python Python Basics All Together Now Branch and Loop

Amit Ramjee
Amit Ramjee
702 Points

How does the shell know to print the "Do you want to proceed" option without PRINT function?

How does the shell know to print the "Do you want to proceed" option without PRINT function? I thought you always need the PRINT function to display output to the user? At the point where Craig does,

should_proceed = input("Do you want to proceed? Y/N? ")

1 Answer

Steven Parker
Steven Parker
173,991 Points

The "input" statement is another way to display output; but after the output is shown, it waits for the user to input a response. The user's response is then returned as the value of the function. So you might think of "input" as short for "print_and_wait_for_input".

Amit Ramjee
Amit Ramjee
702 Points

Thanks, that's helpful. Used to having to PRINT input lines out in java.

Steven Parker
Steven Parker
173,991 Points

I've found that knowing other language(s) is both helpful and an opportunity for confusion when learning new ones!

Glad I could help. Happy coding!