Skip to content

Python, Accepting Input

New Course Coming Soon:

Get Really Good at Git

In a Python command line application you can display information to the user using the print() function:

name = "Roger"
print(name)

We can also accept input from the user, using input():

print('What is your age?')
age = input()
print('Your age is ' + age)

This approach gets input at runtime, meaning the program will stop execution and will wait until the user types something and presses the enter key.

You can also do more complex input processing and accept input at program invocation time, and we’ll see how to do that later on.

This works for command line applications. Other kinds of applications will need a different way of accepting input.

Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching Summer 2024. Join the waiting list!
→ Get my Python Handbook
→ Get my Python Handbook

Here is how can I help you: