code that does a 5 round dice game. it starts at rounf o but i want it to start at round 1 or at least when...
up vote
-1
down vote
favorite
import random
def authorise():
correctusers = ["duha", "evan","mr.dad"]
correctpassword = ("7")
user = input("Please enter name ")
while user not in correctusers:
user = input("Please enter name valid username ")
password = input("Please enter password ")
while password != correctpassword:
password = input("Password not correct,try again ")
return user
def roll_dice():
roll1 = random.randint(1,6)
roll2 = random.randint(1,6)
score = roll1 + roll2
if score % 2 == 0:
score = score + 10
else:
score = score - 5
if roll1 == roll2:
score = score + random.randint(1,6)
return score
#Main Program
player1 = authorise()
print("player 1 will be ", player1)
player2 = authorise()
print("player 2 will be ",player2)
print( player1, " vs. ", player2)
print(" ")
print(" ")
print(" ")
player2_score = 0
player1_score = 0
for x in range(6):
player1_score = player1_score + roll_dice()
player2_score = player2_score + roll_dice()
print("round,", x,". "
,player1, "got", player1_score,"and player 2 got", player2_score)
print(" ")
print(" ")
print(" ")
print(player1," got ",player1_score, " altogether and", player1, "got", player2)
i need it to start with round 1 or start with round 0 and the ponts are 0. its a dice game that uses a range loop. is there another loop i can use?
python
New contributor
put on hold as off-topic by Graipher, 200_success, alecxe, vnp, Jamal♦ Nov 19 at 1:04
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Graipher, 200_success, alecxe, vnp, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-1
down vote
favorite
import random
def authorise():
correctusers = ["duha", "evan","mr.dad"]
correctpassword = ("7")
user = input("Please enter name ")
while user not in correctusers:
user = input("Please enter name valid username ")
password = input("Please enter password ")
while password != correctpassword:
password = input("Password not correct,try again ")
return user
def roll_dice():
roll1 = random.randint(1,6)
roll2 = random.randint(1,6)
score = roll1 + roll2
if score % 2 == 0:
score = score + 10
else:
score = score - 5
if roll1 == roll2:
score = score + random.randint(1,6)
return score
#Main Program
player1 = authorise()
print("player 1 will be ", player1)
player2 = authorise()
print("player 2 will be ",player2)
print( player1, " vs. ", player2)
print(" ")
print(" ")
print(" ")
player2_score = 0
player1_score = 0
for x in range(6):
player1_score = player1_score + roll_dice()
player2_score = player2_score + roll_dice()
print("round,", x,". "
,player1, "got", player1_score,"and player 2 got", player2_score)
print(" ")
print(" ")
print(" ")
print(player1," got ",player1_score, " altogether and", player1, "got", player2)
i need it to start with round 1 or start with round 0 and the ponts are 0. its a dice game that uses a range loop. is there another loop i can use?
python
New contributor
put on hold as off-topic by Graipher, 200_success, alecxe, vnp, Jamal♦ Nov 19 at 1:04
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Graipher, 200_success, alecxe, vnp, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
4
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
Nov 18 at 12:23
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
import random
def authorise():
correctusers = ["duha", "evan","mr.dad"]
correctpassword = ("7")
user = input("Please enter name ")
while user not in correctusers:
user = input("Please enter name valid username ")
password = input("Please enter password ")
while password != correctpassword:
password = input("Password not correct,try again ")
return user
def roll_dice():
roll1 = random.randint(1,6)
roll2 = random.randint(1,6)
score = roll1 + roll2
if score % 2 == 0:
score = score + 10
else:
score = score - 5
if roll1 == roll2:
score = score + random.randint(1,6)
return score
#Main Program
player1 = authorise()
print("player 1 will be ", player1)
player2 = authorise()
print("player 2 will be ",player2)
print( player1, " vs. ", player2)
print(" ")
print(" ")
print(" ")
player2_score = 0
player1_score = 0
for x in range(6):
player1_score = player1_score + roll_dice()
player2_score = player2_score + roll_dice()
print("round,", x,". "
,player1, "got", player1_score,"and player 2 got", player2_score)
print(" ")
print(" ")
print(" ")
print(player1," got ",player1_score, " altogether and", player1, "got", player2)
i need it to start with round 1 or start with round 0 and the ponts are 0. its a dice game that uses a range loop. is there another loop i can use?
python
New contributor
import random
def authorise():
correctusers = ["duha", "evan","mr.dad"]
correctpassword = ("7")
user = input("Please enter name ")
while user not in correctusers:
user = input("Please enter name valid username ")
password = input("Please enter password ")
while password != correctpassword:
password = input("Password not correct,try again ")
return user
def roll_dice():
roll1 = random.randint(1,6)
roll2 = random.randint(1,6)
score = roll1 + roll2
if score % 2 == 0:
score = score + 10
else:
score = score - 5
if roll1 == roll2:
score = score + random.randint(1,6)
return score
#Main Program
player1 = authorise()
print("player 1 will be ", player1)
player2 = authorise()
print("player 2 will be ",player2)
print( player1, " vs. ", player2)
print(" ")
print(" ")
print(" ")
player2_score = 0
player1_score = 0
for x in range(6):
player1_score = player1_score + roll_dice()
player2_score = player2_score + roll_dice()
print("round,", x,". "
,player1, "got", player1_score,"and player 2 got", player2_score)
print(" ")
print(" ")
print(" ")
print(player1," got ",player1_score, " altogether and", player1, "got", player2)
i need it to start with round 1 or start with round 0 and the ponts are 0. its a dice game that uses a range loop. is there another loop i can use?
python
python
New contributor
New contributor
New contributor
asked Nov 18 at 12:23
duha
1
1
New contributor
New contributor
put on hold as off-topic by Graipher, 200_success, alecxe, vnp, Jamal♦ Nov 19 at 1:04
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Graipher, 200_success, alecxe, vnp, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Graipher, 200_success, alecxe, vnp, Jamal♦ Nov 19 at 1:04
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Graipher, 200_success, alecxe, vnp, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
4
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
Nov 18 at 12:23
add a comment |
4
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
Nov 18 at 12:23
4
4
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
Nov 18 at 12:23
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
Nov 18 at 12:23
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
4
Hey, welcome to Code Review! This question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Graipher
Nov 18 at 12:23