Latest Awards
Complete 10 python programs which focus on loops.

morgan

Score over 100 points in total

vincebanter10

Complete any 5 python programs

vincebanter10

Complete 3 python list based tasks

vincebanter10

Complete 5 python list based tasks

vincebanter10

Complete 10 python list based tasks

dman12

Score over 1000 points in total

april-logan

Complete any pygame task

april-logan

Complete any 3 pygame tasks

april-logan

You have to complete 5 pygame tasks

april-logan

Score over 500 points in total

sam-edmund

Complete any pygame task

sam-edmund

Complete any 3 pygame tasks

sam-edmund

You have to complete 5 pygame tasks

sam-edmund

Complete any pygame task

12wrigleyf

Complete any 3 pygame tasks

12wrigleyf

You have to complete 5 pygame tasks

12wrigleyf

Score over 500 points in total

jhoughton12

Complete any 10 python prograns

jhoughton12

Complete 10 python programs which focus on loops.

jhoughton12

Python Score
tasks = 0
achivements = 0
freestyle = 0
Total = 0
Top 5 Scores
114gilo 3470
2alexdawkins 2515
3joss-nolan-2 2500
4byrnebrian 2050
512wattsl 1720
Click to view all scores
Who else completed this task?
19 people have completed this task! Below are some of those users!

12boonhamf byrnebrian
14gilo 12partelk
12gleesons thomaspep
joss-nolan-2 hxyshul
12wattsl johannes-z

Dice betting game with sound

You are to create a game of dice. The game works like this –

  •  The player rolls two dice
  • If the dice have the same value (eg 2,2 or 5,5) then they win!
  • If the dice do not have the same value they loose.

This is going to be a betting game. The user starts off with 400 points and can choose how much they want to get each time (between 1 and 50). The game will play like this –

  • The user can choose to roll again or stop.
  • If the user is out of money the game ends
  • They can choose a bet amount between 1 and 50
  • The dice are rolled
  • If the player wins they get double the bet amount added to their money
  • If they loose the bet amount is subtracted from the amount.

The game should use sound effects (as wav or wave files). You can use the winsound library

import winsound
winsound.PlaySound("test.wav", winsound.SND_FILENAME)

To help you can use the following code to get you started.

 

import winsound
import time
import random
print "The amazing dice game"
#http://www.bfxr.net/ use this website to generate sound effects
# this will play the sound. The sound MUST BE IN THE SAME FOLDER AS
# YOUR PYTHON FILE!!!
winsound.PlaySound("test.wav", winsound.SND_FILENAME)
time.sleep(4)

playAgain = True
money = 400

while playAgain == True and ????????:

	# You need to write the lot yourself :)
	print "you have ", money, "left"

You need to log in or create an account to submit code!

Leave a Reply

You must be logged in to post a comment.