samedi 2 janvier 2016

TypingError : randint() takes exactly 3 arguments (2 given)

I know there is a similar question/problem to this on stakeflow but the answer didn't help me. My code :

import random
name=input("Welcome to this Arithmetic quiz,please enter your name:")
number1=random.randint(1,50)

number2=random.randint(1,50)


oper=random.randint('+','-','*')

input('question 1 is:'+str(number1)+'oper'+str(number2)+'=')

For line 5 it gives me this error^^.I am trying to create 2 random numbers with 1 random operation and input it together for the user.

P.S. When I input the question how will python know if the answer is right or wrong? Or do I have to say 'if answer=True' print('correct') else: print('Incorrect').




Aucun commentaire:

Enregistrer un commentaire