Write a program that accepts a number of players as input

Assignment Help Python Programming
Reference no: EM132382450

Question

Suppose we want to allow 2 or 3 players to play a dice game with a fair 6-sided die. The player with the highest dice roll wins. If there are 2 players with the highest number, they both win. If there are 3 players with the highest number, then they all win.

A program that accepts a number of players as input. If the user enters a number that is not 2 or 3, then return a friendly error message. If the user enters 2 or 3, then the program should randomly assign dice rolls to the 2 or 3 players and return a friendly message with the dice rolls for each player and the result of the game. Test the game 5 times with 2 players and 5 times with 3 players to try to get a variety of different output results.

You have started and was told to use this for the random number assignment

def assign_dice_roll(plyr_number):

import random

roll = random.randint(1, 6)

return (plyr_number, roll

Reference no: EM132382450

Questions Cloud

Write a program that asks for a persons name and age : A ticket kiosk at the movie theater prints tickets for customers. It asks the customer its age and charges the customer based on their age.
What is the present value of a 29-year : What is the present value (aka price) of a 29-year, pure discount bond (zero coupon bond) that pays $1000 at maturity if it is priced
Explain a program that prompts the user for a name : You task is to explain a program that prompts the user, for a name, an hourly rate, and number of hours worked, and computes and prints a paycheck.
MGT601 Dynamic Leadership Assignment Problem : MGT601 Dynamic Leadership Assignment help and solution, Torrens University Australia, Assessment help - Explore and reflect on self- development as a leader
Write a program that accepts a number of players as input : A program that accepts a number of players as input. If the user enters a number that is not 2 or 3, then return a friendly error message.
Prompt user for a proper input which is of the form accnum : Assume every accounts opening balance is 500 & every account needs to maintain a minimum balance of 100. Keep offering to do transactions until user wants.
Calculate the mean of a list of numbers and print the result : A function to accept a list of numbers as input. The program will output the min, max, mean, and median of the list including the label;
Make a function that counts using a while loop : A function to calculate the median of a list of numbers and print the result. Make a function that counts using a while loop.
What will be the depth where you trigger the alarm : Write the program code and develop a document that demonstrates you can use the code to solve this problem using iterative techniques.

Reviews

Write a Review

Python Programming Questions & Answers

  Create a given artisan 3D pancake

How many cubic units of batter (to some given degree of accuracy) is required to create a given artisan 3D pancake defined by a given blueprint

  Display the number of rounds played and number of times

In the game Rock Paper Scissors, two players simultaneously choose one of three options: rock, paper, or scissors. If both players choose the same option.

  Display the monetary value of the change in currency format

Write a program that determines the value of a jar of change. Prompt the user for the number of quarters, dimes, and nickels and then display the monetary value

  Look up terms in a tech dictionary

Create a program that allows a user to look up terms in a tech dictionary - programming or scripting that is of interest to you, and complete one or more web-based tutorials on the topic.

  Project title email spam filterabstractanalyze the emails

project title email spam filterabstractanalyze the emails and predict whether the mail is a spam or not a spam.to work

  Write a program that simulates a traffic light

Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green.

  Write Python program that generates an informative web site

ICT112 Assignment - Generated Web Site for Aussie Airport Passenger Movements. University of the Sunshine Coast. write a Python program that generates a site

  Write python code to load your dataset into a pandas data

A medium-size Australian company imaginary has given you one year of data about the online purchases that their customers have made.

  Create an employee class that keeps data attributes

Create an Employee class that keeps data attributes for the following pieces of information: Employee Name and Employee Number

  Creates a car object then calls the accelerate method five

Design a program that creates a Car object then calls the accelerate method five times. After each call to the accelerate method, get the current speed of cars.

  Find the sample program illustrating the split method

Plan program carefully on paper before beginning code. You may find the sample program illustrating the 'split' method to be a useful reference.

  Determine what does that ratio look like

CSC 540 We are interested in tracking the ratio of half pills to all the pills left in the jar. When you start with a new jar of N whole pills.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd