If you have any questions, comments or issues with this project please post them here!
Let’s multiply on the floor. Why? Because you can’t use tables .
https://replit.com/@JackAdem/Day-021-Project-21-Math-Game?v=1
Day 21 of #Replit100DaysOfCode #100DaysOfCode.
Could someone point me in the right direction please!
print("Math Game!")
print()
multiple = int(input("Name your multiples: "))
print()
attempt = 1
for i in range(1,8):
total = i*multiple
answer = int(input(i," x ",multiple," = ")
if answer == total:
print("Great work!")
attempt +=1
else:
print("Nope! The answer was",total)
print()
print("You scored", attempt,"out of 10")
Welcome, @Wen-LinLin!
You’re missing another closing parenthesis here and you cannot put multiple values in an input
. It should be this:
answer = int(input(str(i) + " x " + str(multiple) + " = "))
thank you! such a careless mistake!
when I use this, I get the following error message:
Traceback (most recent call last):
File "main.py", line 8, in <module>
answer=int(input(i , " x " , multiples , " = "))
TypeError: input expected at most 1 argument, got 4
Like I said
So it needs to be
now I get this error - honestly this is driving me crazy!
answer = int(input(i + " x " + multiple + " = "))
TypeError: unsupported operand type(s) for +: ‘int’ and ‘str’
Try this
answer = int(input(str(i) + " x " + str(multiple) + " = "))
perfect thanks so much - I wondered if it was something like that but was unsure about syntax. Sanity nearly restored…
also just realised that someone else answered that earlier and I totally missed it - thanks for your patience.