Sep-10-2017, 02:27 AM
I haven't coded a thing in 25 years and that was mostly basic. I don't really understand what the various shells are for. And I'm having issues with data flow (where the data goes and how to access it.)
In the example below I don't understand how to access the data that I return from the function after I drop out of the function.
In the example below I don't understand how to access the data that I return from the function after I drop out of the function.
# Player Generator from random import randrange def heightdice(die): age=randrange(15,19) htroll=[] b=0 while b<die: roll=randrange(0,13) htroll.append(roll) b=b+1 htroll.sort() if htroll[1]>0: if htroll[0]==htroll[1]: htroll[0]=htroll[0]-1 htroll[1]=htroll[1]+1 for w in htroll: print (w,end=' ') print() print(sum(htroll)+130) ageheight=[] ageheight.append(sum(htroll[3:10])+int(htroll[2]/2)+129) ageheight.append(sum(htroll[2:10])+130) ageheight.append(ageheight[1]+int(round(htroll[1]/2+.1,0))) ageheight.append(ageheight[1]+htroll[1]) ageheight.append(ageheight[3]+int(round(htroll[0]/2+.1,0))) ageheight.append(ageheight[3]+htroll[0]) height=ageheight[age-15] print('Age:',age,' Height:',height) return ageheight,age heightdice(10) if ageheight[age-15]<135+age*2: heightdice(10)
Error:So how do I make ageheight and age usable
Traceback (most recent call last):
File "/Users/raymond/Documents/playgen2.py", line 37, in <module>
if ageheight[age-15]<135+age*2:
NameError: name 'ageheight' is not defined