Created
October 9, 2013 17:41
-
-
Save kaydell/6905184 to your computer and use it in GitHub Desktop.
A Python 3 Demo of Asking the User To Input An Int
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is a demonstration of asking the user to enter an | |
# int in Python 3 | |
# ask the user to enter an int | |
string = input("Please enter an int: ") | |
# the function input() returns a str we need to convert it to be an int | |
n = int(string) | |
# echo the int back to the user | |
print("You entered: %d" % (n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment