jeudi 15 janvier 2015

How does the eval command work in my program? [on hold]

just got into Python and i want to create a program where i will ask the user 10 questions and see if they get it right. Well ive been having trouble. You see if i ask them 7+2, if they type in either 9 (7+2) or 5 (7-2) or 14 (7*2) the answer will all be displayed as correct.


Here is the program: http://ift.tt/1CrH1Ab


So i opened up a new program and added the same coding however i edited it to use the eval command which my friend suggested. However this program just says every answer i give is correct :/ Here is the program: http://ift.tt/1B71blK


So i was wondering, dear users of Stack overflow, if you could help me figure out how to output the correct statements and why they are doing this and also give me a little insight of what this eval does because to be honest i have no clue.


Thanks ^_^


Aucun commentaire:

Enregistrer un commentaire