In Python you can prompt the user to enter information using the input() function.
The following example demonstrates how to ask for a user’s name and age:
name = input("Enter your name: ")
age = int(input("Enter your age: ")) # Converts input to integer
print("Your name is", name, "and you are", age, "years old.")
Enter your name: Diana Bishop
Enter your age: 28
Your name is Diana Bishop and you are 28 years old.
Use the Search Bar to find content on MarketingMind.
Contact | Privacy Statement | Disclaimer: Opinions and views expressed on www.ashokcharan.com are the author’s personal views, and do not represent the official views of the National University of Singapore (NUS) or the NUS Business School | © Copyright 2013-2025 www.ashokcharan.com. All Rights Reserved.