Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Name: module1
- # Purpose:
- #
- # Author: Liam
- #
- # Created: 28/04/2016
- # Copyright: (c) Liam 2016
- # Licence: <your licence>
- #-------------------------------------------------------------------------------
- #for loop
- betteam = ""
- betmoney = 0
- number = 0
- random = 0
- team1score = 0
- team2score = 0
- RugbyTeamsList = ["England, Scotland, Italy, Ireland, Wales, France"]
- import random
- def chooseTeam():
- print "Please input the name of your supporting team and the team they are playing against to find out the odds of them winning the match"
- team = str(raw_input("Please Enter the name of Team"))
- return team
- def score():
- score = random.randint(0,9)
- return score
- def printscore(team, teamscore):
- print str(team)+" "+str(teamscore)
- def checkresult(team1score,team2score):
- if team1score == team2score:
- print "Re-match is required"
- if (team1score > team2score):
- print "your team has won"
- else:
- print "Your team has lost"
- def menu ():
- print "1. Find out teams odds"
- print "2. Place a bet on your team."
- print "3. View previous bets."
- print "4. Show Rugby teams playing in the RBS six nations."
- print "5. Exit."
- #While loop continues to ask for username and password if inccorect
- print " Welcome to Shepherds Rugby Betting SRB."
- print " Please proceed to login to your account"
- loop = True
- while(loop):
- username=raw_input("Please input your username : ")
- password = raw_input(" Please input your password : ")
- #Username and Password must match criteria
- #Username = liam shepherd password= secretpassword
- if (username == "liam shepherd" and password == "secretpassword") :
- print 'You have successfully logged in'
- loop = False
- menu ()
- number = int(raw_input ("Enter the number of the menu option you would like to access"))
- while (number !=5):
- if (number == 1):
- #Team odds of winning calculator
- #Choosing teams to play
- team1 = chooseTeam()
- team2 = chooseTeam()
- team1score = score()
- team2score = score()
- printscore(team1, team1score)
- printscore(team2, team2score)
- #Overall score from the game
- checkresult(team1score,team2score)
- menu ()
- number = int(raw_input ("Enter the number of the menu option you would like to access"))
- elif (number == 2):
- betteam=raw_input("What team would you like to place your bet on?")
- betmoney=float(raw_input("How much would you like to bet on your team(GBP)"))
- menu ()
- number = int(raw_input ("Enter the number of the menu option you would like to access"))
- elif (number == 3):
- print "Your previous bets are..."
- print betteam
- print "GBP"
- print betmoney
- menu ()
- number = int(raw_input ("Enter the number of the menu option you would like to access"))
- elif (number == 4):
- print RugbyTeamsList
- break
- else :
- print "please enter a valid numbetr from 1 to 5"
- menu ()
- number = int(raw_input ("Enter the number of the menu option you would like to access"))
- print "Thank you, hope to see you again."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement