Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CorrectUsername1 = "tombell"
- CorrectPassword1 = "tom123654"
- score1= 0
- loop = 'true'
- while (loop == 'true'):
- username = input("Please enter your username: ")
- if (username == CorrectUsername1):
- password = input("Please enter your password: ")
- if (password == CorrectPassword1):
- print ("Logged in successfully welcome" , username)
- loop = 'false'
- else:
- print ("Password incorrect!")
- else:
- print ("Username incorrect!")
- CorrectUsername2 = "ryanyoung"
- CorrectPassword2 = "ryanyoung123987"
- score2= 0
- loop = 'true'
- while (loop == 'true'):
- username = input("Please enter your username: ")
- if (username == CorrectUsername2):
- password = input("Please enter your password: ")
- if (password == CorrectPassword2):
- print ("Logged in successfully welcome " , username)
- loop = 'false'
- else:
- print ("sorry Password is incorrect!")
- else:
- print ("Username incorrect!")
- if (password == CorrectPassword2 and username == CorrectUsername2 ):
- print("welcome to ryan's dice game")
- player1score =0
- player2score =0
- diceroll1 =0
- diceroll2 =0
- for counter in range(0,5):
- import random
- go = input("player 1 do you wanna roll")
- Random_number = random.randint(1,6)
- diceroll1= diceroll1 + Random_number
- print(diceroll1)
- Random_number = random.randint(1,6)
- diceroll= diceroll1 + Random_number
- print(diceroll1)
- if 1== diceroll1%2:
- player1score = player1score - 5
- print("player1 score is", player1score)
- else:
- player1score = player1score + 5
- print("player1 score is", player1score)
- go = input("player 2 do you wanna roll")
- Random_number = random.randint(1,6)
- diceroll2= diceroll2 + Random_number
- print(diceroll2)
- Random_number = random.randint(1,6)
- diceroll2= diceroll2 + Random_number
- print(diceroll2)
- if 1== diceroll2%2:
- player2score = player2score - 5
- print("player2 score is", player2score)
- else:
- player2score = player2score + 5
- print("player2 score is", player2score)
- if player1score>player2score:
- print("player1 you won")
- else:
- print("player2 you won")
- text_file = open("player1", "a")
- text_file.write("player1score")
- text_file.write("diceroll1")
- text_file.close()
- print("File created for player 1.")
- text_file = open("player2", "a")
- text_file.write("player2score")
- text_file.write("diceroll2")
- text_file.close()
- print("File created for player 2.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement