Programminganybody on here good with python?
Posted:

Programminganybody on here good with python?Posted:

Yolo
  • Wise One
Status: Offline
Joined: Jan 13, 201311Year Member
Posts: 541
Reputation Power: 28
Status: Offline
Joined: Jan 13, 201311Year Member
Posts: 541
Reputation Power: 28
never mind guys i got it to work sorry


Last edited by Yolo ; edited 1 time in total
#2. Posted:
Yolo
  • Christmas!
Status: Offline
Joined: Jan 13, 201311Year Member
Posts: 541
Reputation Power: 28
Status: Offline
Joined: Jan 13, 201311Year Member
Posts: 541
Reputation Power: 28
Yolo wrote Right now i'm teaching myself python and i'm using trying to call a function. Do you need to prototype a function like you do in c/c++. I read somewhere that you don't but for some reason i keep getting an error that says "name 'addition' is not defined", when I made a function clearly named addition. Here is the source code for that function let me know if I did something wrong:
def addition():
print("Enter -999 to exit additon.")
while i !=-999:
seed.random()
rand1=random.randint(0,100)
rand2=random.randint(0,100)
correctAnswer=rand1+rand2
print("what is",rand1,"+",rand2,"?")
i=eval(input())
if correctAnswer==i:
print("Your answer is correct!")
else:
print("unfortunatly your answer is wrong.")

for some reason the formatting of the code is off with the indents and such.
#3. Posted:
dooon
  • TTG Fanatic
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Status: Offline
Joined: Mar 21, 201014Year Member
Posts: 4,083
Reputation Power: 781
Users browsing this topic: None
Jump to:


RECENT POSTS

HOT TOPICS