Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # Name: module1
  3. # Purpose:
  4. #
  5. # Author: Liam
  6. #
  7. # Created: 28/04/2016
  8. # Copyright: (c) Liam 2016
  9. # Licence: <your licence>
  10. #-------------------------------------------------------------------------------
  11. #for loop
  12. betteam = ""
  13. betmoney = 0
  14. number = 0
  15. random = 0
  16. team1score = 0
  17. team2score = 0
  18.  
  19. RugbyTeamsList = ["England, Scotland, Italy, Ireland, Wales, France"]
  20.  
  21. import random
  22. def chooseTeam():
  23. 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"
  24. team = str(raw_input("Please Enter the name of Team"))
  25. return team
  26.  
  27. def score():
  28. score = random.randint(0,9)
  29. return score
  30.  
  31. def printscore(team, teamscore):
  32. print str(team)+" "+str(teamscore)
  33.  
  34.  
  35. def checkresult(team1score,team2score):
  36. if team1score == team2score:
  37. print "Re-match is required"
  38.  
  39. if (team1score > team2score):
  40. print "your team has won"
  41.  
  42. else:
  43. print "Your team has lost"
  44. def menu ():
  45. print "1. Find out teams odds"
  46. print "2. Place a bet on your team."
  47. print "3. View previous bets."
  48. print "4. Show Rugby teams playing in the RBS six nations."
  49. print "5. Exit."
  50.  
  51. #While loop continues to ask for username and password if inccorect
  52. print " Welcome to Shepherds Rugby Betting SRB."
  53. print " Please proceed to login to your account"
  54. loop = True
  55. while(loop):
  56. username=raw_input("Please input your username : ")
  57. password = raw_input(" Please input your password : ")
  58. #Username and Password must match criteria
  59. #Username = liam shepherd password= secretpassword
  60. if (username == "liam shepherd" and password == "secretpassword") :
  61. print 'You have successfully logged in'
  62. loop = False
  63.  
  64. menu ()
  65. number = int(raw_input ("Enter the number of the menu option you would like to access"))
  66. while (number !=5):
  67. if (number == 1):
  68. #Team odds of winning calculator
  69. #Choosing teams to play
  70. team1 = chooseTeam()
  71. team2 = chooseTeam()
  72.  
  73. team1score = score()
  74. team2score = score()
  75. printscore(team1, team1score)
  76. printscore(team2, team2score)
  77. #Overall score from the game
  78. checkresult(team1score,team2score)
  79. menu ()
  80. number = int(raw_input ("Enter the number of the menu option you would like to access"))
  81.  
  82. elif (number == 2):
  83.  
  84. betteam=raw_input("What team would you like to place your bet on?")
  85. betmoney=float(raw_input("How much would you like to bet on your team(GBP)"))
  86.  
  87.  
  88.  
  89. menu ()
  90. number = int(raw_input ("Enter the number of the menu option you would like to access"))
  91.  
  92.  
  93. elif (number == 3):
  94. print "Your previous bets are..."
  95. print betteam
  96. print "GBP"
  97. print betmoney
  98. menu ()
  99. number = int(raw_input ("Enter the number of the menu option you would like to access"))
  100.  
  101. elif (number == 4):
  102.  
  103. print RugbyTeamsList
  104. break
  105. else :
  106. print "please enter a valid numbetr from 1 to 5"
  107. menu ()
  108. number = int(raw_input ("Enter the number of the menu option you would like to access"))
  109.  
  110.  
  111. print "Thank you, hope to see you again."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement