Apr-18-2020, 03:21 PM
Hey all, This was a past homework assignment that I just wanted to get clarification on in regards to my code.
The program is suppose to roll 2 dice, producing 2 random numbers in which those numbers are used to give a fortune.
I'm not positive on what I need to correct.
any help is appreciated.
The program is suppose to roll 2 dice, producing 2 random numbers in which those numbers are used to give a fortune.
# Import Functions import random # Declare Functions def roll(): roll_1 = random.randrange(1,6) roll_2 = random.randrange(1,6) total_roll = roll_1 + roll_2 print("You Roll your First Die :", roll_1) print("You Roll your Second Die :", roll_2) print("Total Roll :", total_roll) return (total_roll) def future(total_roll): if total_roll == 2 or total_roll == 3: print("When fear hurts you, conquer it and defeat it!") elif total_roll == 4 or total_roll == 5: print("You will become great if you believe in yourself.") elif total_roll == 6 or total_roll == 7: print("You will learn from you mistakes... You will learn alot today.") elif total_roll == 8 or total_roll == 9: print("A new voyage will fill your life with untold memories.") elif total_roll == 10 or total_roll == 11: print("Be on the lookout for coming events; They cast their shadows beforehand.") else: print("Serious trouble will bypass you") # Declare Varibles # Input # Process # Output roll() future()It keeps throwing this error
Error:Traceback (most recent call last):
File "C:\Users\Nevalle\Desktop\Lab10.py", line 43, in <module>
future()
TypeError: future() missing 1 required positional argument: 'total_roll'
I've tried passing the Variable straight from roll to future, while it does work it still throws this error after the code is ran. I've tried recalling the variable back in the main code with future(total_roll) which still doesn't fix it.I'm not positive on what I need to correct.
any help is appreciated.