Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101605
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2016-01-13 04:23 -0800 |
| Message-ID | <d668ec4e-509e-48a4-9be5-017077629c6c@googlegroups.com> (permalink) |
| Subject | local variable 'juveniles' referenced before assignment |
| From | Alan Robinson <arobinson@lordlawson.org.uk> |
def menu():
option = int(input("Please select an option: \n 1: Set Generation 0 Values \n 2: View Generation 0 Values \n 3: Run Model \n 4: Print values"))
if option == 1:
juveniles,adults,seniles = setGen()
elif option == 2:
displayGen()
elif option == 3:
runModel(juveniles,adults,seniles)
elif option == 4:
print(juveniles,adults,seniles)
menu()
def setGen():
#enter number of juveniles
juveniles = int(input("How many juveniles are in the total popluation?"))
#enter number of adults
adults = int(input("How many Adults are in the total popluation?"))
#enter number of seniles
seniles = int(input("How many Seniles are in the total popluation?"))
#enter juvenilesenile survival rates
return(juveniles,adults,seniles)
menu()
when I go to print I get the above error I can't see a solution please help
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
local variable 'juveniles' referenced before assignment Alan Robinson <arobinson@lordlawson.org.uk> - 2016-01-13 04:23 -0800
Re: local variable 'juveniles' referenced before assignment Chris Angelico <rosuav@gmail.com> - 2016-01-13 23:32 +1100
Re: local variable 'juveniles' referenced before assignment Alan Robinson <arobinson@lordlawson.org.uk> - 2016-01-13 04:54 -0800
Re: local variable 'juveniles' referenced before assignment Chris Angelico <rosuav@gmail.com> - 2016-01-14 00:05 +1100
Re: local variable 'juveniles' referenced before assignment Peter Otten <__peter__@web.de> - 2016-01-13 14:05 +0100
Re: local variable 'juveniles' referenced before assignment Alan Robinson <arobinson@lordlawson.org.uk> - 2016-01-13 05:22 -0800
Re: local variable 'juveniles' referenced before assignment Alan Robinson <arobinson@lordlawson.org.uk> - 2016-01-13 05:26 -0800
csiph-web