Please help with %s problem - HELP

As u can see my % doesnt take the %s place, why so?

print("Welcome to the hardest quiz ever!\n")
correct = 0
incorrect = 0
total = 0
number = 0
question = "1 + 1"
x = 1
answer = 2

def questions(x, question, answer):
    a = input("%s Question:\n%s") % (x, question)
    attempts = 3
    for i in range(1, 4):
        if a == answer:
            print("That is correct!")
            correct = correct + 1
            return correct 
            print("That is incorrect. You have %s tries left.") % (attempts)

questions(x, question, answer) 

ps. just help me with the %s problem, my script isnt done yet. So there might be some other mistakes

well the string is part of input, so the things you want on the placeholder should be as well:

a = input("%s Question:\n%s" % (x, question))

and x doesn’t seem to be a string, so %s doesn’t seem like a suitable placeholder

So it have to be a string if I want to replace the %s with the %. It cant be an int

the s of %s is for string, you could use %i or %d instead as you can read here

w8 is it then possible to have two diffrent %s in one like:
a = input("%i Question:\n%s") % (x, question)

where x is an int, while question is a string.
I just still get the error. How would u make it if its not possible this way?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.