How do you ask a question in Python 3?

+2 votes
asked Jun 22 by Litterbox42 (180 points)
I'm coding a game, and I don't know how to get the program to let my player type in an answer. Can someone help me, please?

3 Answers

0 votes
answered Jun 24 by Peter Minarik (7,260 points)

You can search the Internet for various documentations and tutorials on Python.

One of them is on W3School that describes how to handle user input in Python:

+1 vote
answered Jun 27 by Jayasurya (200 points)

For Example if you want the user to enter his/age you can prompt the user by using this line of code : 

age = int(input("Enter your age : "))

for accepting the name and other details : 

name = input('Enter your name : ')

0 votes
answered Jul 2 by Hidayakhalifa1 (140 points)

To ask a simple question like what school you go to, do this:

school = input("What school do you go to? : ")

print("You go to " , school)

If you want to ask a different question, just replace the variable with what the question is about,  replace the school question with yours then,  print you start of the answer.


Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.