Problem with Random randind | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem with Random randind

Hey guys, Learning Python is my hobby, and I am working on my own project; simply simulator for DnD players, and i stuck with random and if statement. Could you help me upgrade code, that If race is for example ELF, code pick random age from 100;400 not from 18;400 like in the first line?? Age = str(random.randint(18, 400)) if 'Gnome' or 'Human' in Race: print('Age: ' + str(random.randint(18, 100))) elif 'Dwarf' or 'Half-Elf' or 'Half-Orc' in Race: print('Age: ' + str(random.randint(50, 150))) elif 'Dragonborn' or 'Elf' or 'Halfing' or 'Tiefling' in Race: print('Age: ' + str(random.randint(100, 400))) If you want help me please leave your comment or you can find me on discord: Gilbert#2777

12th Mar 2021, 9:17 PM
Gilbert
Gilbert - avatar
2 Answers
+ 1
You only problem 😂😂😂😂
13th Mar 2021, 5:00 AM
Awin Dutta
Awin Dutta - avatar
0
fix elif, as an example: elif 'x' in s or 'y' in s or 'v' in s: do smthg and where is <<Race>> variable?
12th Mar 2021, 11:45 PM
iTech
iTech - avatar