User Input

User input is essential when you are creating interactive programs. In this lesson I will be showing you how to get user input so you can build better software. Let’s start with the basic name example:

fname = input("Please enter your first name")
print("Hi " + fname + ", it's nice to meet you")

We can combine input with conditional logic to make sure the user provides us with what we want:

number = input("Please enter a whole number greater than 5")
if int(number) > 5:
    print("You entered a number greater than five!")
else:
    print("Err... " + number + " is NOT greater than 5...")

It’s hard to get into interactive menus WITHOUT going into loops but that goes beyond the scope of this lesson. For now, write a few scripts to gather user input and then do something with that input.

Server Academy Members Only

Want to access this lesson? Just sign up for a free Server Academy account and you'll be on your way. Already have an account? Click the Sign Up Free button to get started..

0 0 votes
Lesson Rating
Subscribe
Notify of
profile avatar
0 Comments
Inline Feedbacks
View all comments

Saving Progress...

Sign up for free!

Sign up for free and get instant access to this course!.

Python 3 Fundamentals

0%

0/1 Lessons

Installing Python on Windows

• 1hr 17min

0 / 4 lessons complete

Python Basics

• 28min

0 / 7 lessons complete

Python Variables

• 41min

0 / 8 lessons complete

Even more Python Variables!

• 41min

0 / 6 lessons complete

Conditional Statements

• 15min

0 / 3 lessons complete

Writing Functions

• 30min

0 / 5 lessons complete

Python Loops

• 23min

0 / 5 lessons complete

Python PIP and Modules

• 18min

0 / 4 lessons complete

RegEx

• 26min

0 / 4 lessons complete

Working with APIs

• 12min

0 / 3 lessons complete

Course Conclusion

• 2min

0 / 1 lessons complete