Ask coding questions

← Back to all posts
test
FololesiaOtutah (0)

i have a test at school and i do'nt no what to do

Commentshotnewtop
malvoliothegood (174)

If you want to get a number as input to your program you can use the input and int functions. Use input to ask a question and get the text string that the user types at the console prompt, and use int to change the string into a number. Here is an example that asks a person for their age, converts it into a number and prints out a response.

age_text = input("How old are you? "))
age_number = int(age_text)
if age_number < 5:
    print("You are really young!")
    print("In ten years time you will be", str(age_number + 10))

I hope this helps.

ash15khng (393)

Sorry, we can't help with tests. If this is homework, could you tell us what's wrong with the code?