xxxxxxxxxx
string = input("Enter a string: ")
number = int(input("Enter a number: "))
xxxxxxxxxx
# Take user input in python
age = int(input("Type the age: "))
if age <= 18:
print("You are too young to enter here")
xxxxxxxxxx
Use the input() method
Example
#code
name = input("Name Please: ")
print(f'Hello {name}, what can I do for you?')
#console
Name Please:
>>> Steve
Hello Steve, what can I do for you?
xxxxxxxxxx
# Python 3
txt = input("Type something to test this out: ")
# Note that in version 3, the print() function
# requires the use of parenthesis.
print("Is this what you just said? ", txt)
xxxxxxxxxx
print("What is your name?")
name = input()
print(name) # This will print out whatever the user typed