Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do you ask a question in Python 3?

+2 votes
asked Jun 22 by Litterbox42 (200 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?

6 Answers

–1 vote
answered Jun 24 by Peter Minarik (12,220 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:


0 votes
answered Jun 27 by Jayasurya (180 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 : ')

–1 vote
answered Jul 2 by Hidayakhalifa1 (120 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.


0 votes
answered Oct 6 by G4BR13l R0S4 (430 points)
simple,if you need ask to the player "whats the name of your caracther" for example you can write:

print('Name of your character:')

name = input('')

print("the name of your caracter is {}").name #this line can be wrong, mayble the correct is this:print("the name of your caracter is {name}") i dont rememeber but this you dont use now
0 votes
answered Oct 7 by LiOS (5,280 points)

In Python 2.7 =  username = raw_input("Enter username:") - This method is for Python2 which is approaching EOL.

In Python3 = username = raw_input("Enter username:")

Interestingly, Python will read the response as a string, so if you want to read a number and treat it as a number, I would recommend age = int(input("Enter your age : "))

0 votes
answered Oct 11 by kira9966 (140 points)
player=input('enter anwer')

x=str (player)
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.