MIS 301 Programming Assignment 3

docx

School

University Of Arizona *

*We aren’t endorsed by this school

Course

301

Subject

Information Systems

Date

Apr 3, 2024

Type

docx

Pages

3

Uploaded by CoachDiscovery2101

Report
MIS 301 Programming Assignment 3 By Tanishka Bansal Programming Code: import random def spin_slots(): slot1 = random.randint(0, 8) slot2 = random.randint(0, 8) slot3 = random.randint(0, 8) print(f"Display: {slot1} {slot2} {slot3}") if slot1 == slot2 == slot3: print("JACKPOT!") return 10 elif slot1 == slot2 or slot1 == slot3 or slot2 == slot3: print("NICE MATCH!") return 3 return 0 def main(): tokens = int(input("Enter the number of tokens you are starting with: ")) print(f"Tokens = {tokens}") print() while tokens > 0: tokens -= 1 tokens += spin_slots() print(f"Tokens = {tokens}") print() if input("To spin again, hit carriage return; otherwise type any other character: "): break print() if tokens <= 0: print("Final tokens = 0") print("Sorry, you are out of tokens!") else: print(f"Final tokens = {tokens}") if __name__ == "__main__": main() Code Screenshot:
Execution Screenshot:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help