python - My program runs great but my client wants -
my program runs great client wants me remove arguments inside parentheses of point function , move statements determine each die point. talking about? why? accomplish?
code , output follows now. or answer great. in advance!
import random import math min = 1 max = 6 rolls = 5 def main(): count in range(rolls): die_1 = (random.randint(min, max)) die_2 = (random.randint(min, max)) print() print('-----------------------------------------------') combined_roll = point(die_1, die_2) print('this program simulates 2 die being rolled five') print('times , calculates total numbers.') print('here combined rolls dice!') print(die_1) print(die_2) print('the combined roll is:', combined_roll) def point(die_1, die_2): roll_1 = die_1 + die_2 combined_roll = roll_1 return combined_roll main() ----------------------------------------------- program simulates 2 die being rolled 5 times , calculates total numbers. here combined rolls dice! 4 6 combined roll is: 10 ----------------------------------------------- program simulates 2 die being rolled 5 times , calculates total numbers. here combined rolls dice! 4 5 combined roll is: 9 ----------------------------------------------- program simulates 2 die being rolled 5 times , calculates total numbers. here combined rolls dice! 5 5 combined roll is: 10 ----------------------------------------------- program simulates 2 die being rolled 5 times , calculates total numbers. here combined rolls dice! 2 4 combined roll is: 6 ----------------------------------------------- program simulates 2 die being rolled 5 times , calculates total numbers. here combined rolls dice! 5 1 combined roll is: 6
you asked:
what talking about?
def main(): count in range(rolls): print() print('-----------------------------------------------') combined_roll = point() print('this program simulates 2 die being rolled five') print('times , calculates total numbers.') print('here combined rolls dice!') print('the combined roll is:', combined_roll) def point(): die_1 = (random.randint(min, max)) die_2 = (random.randint(min, max)) print(die_1) print(die_2) roll_1 = die_1 + die_2 combined_roll = roll_1 return combined_roll why? accomplish?
it makes main simpler @ cost of making point() little bit more complex.
although, can make point lot simpler if don't need print statements in int.
def point(): return (random.randint(min, max)) + (random.randint(min, max))
Comments
Post a Comment