In video number 13 of the Coding in Python series, you’ll learn how to accept input from the user.
Commands Used in this Video
Simple example of capturing user input and printing it
#!/usr/bin/env python3
print("Enter your name:")
name = input()
print(name)
More efficient input example
#!/usr/bin/env python3
name = input("Enter your name:\n")
print(name)
An example of using input in a string
#!/usr/bin/env python3
name = input("Enter your name:\n")
print("Your name is " + name)
An example of using input in a string
#!/usr/bin/env python3
age = input("Enter your age:\n")
print("You are " + age + " years old")
age2 = int(age) + 50
print("In 50 years, you will be " + str(age2) + years old.")