
February 24th, 2013, 08:33 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 2
Time spent in forums: 11 m 6 sec
Reputation Power: 0
|
|
|
Python Help
Hi,
I've been working on a particular math-quiz game as an introductory project to python scripting. In this program, I use strings of random integers to create new problems every time a question comes up.
However, in one of these chains, the if-then statement that dictates what the program will do depending on if an answer is right or wrong has been malfunctioning. The statement completely bypasses the "correct" option and goes to the "incorrect" route (these are not hard either, its painfully obvious like 8+5=? questions)
The program piece that is malfunctioning looks like this:
import random
Qb=random.randint(1, 10)
Qbb=random.randint(1, 10)
print ('Question 2' + str (Qb) +' + ' + str (Qbb) + ' = ?')
Qba=input()
Qbaa = Qb + Qbb
if Qba == ('Qbaa'):
print ('Correct! + 25 to score!')
Score = Score + 25
print (Score)
else:
print ('Incorrect')
What is causing the correct path to be bypassed?
|