Python Tutorial - While Loop - Dice Game

preview_player
Показать описание
Learn how to make a simple text-based dice game in Python, where you roll 2 dice and have to land a double to win. You will use a While loop to keep the game running until the user wants to finish.

Рекомендации по теме
Комментарии
Автор

Dude, I'm new to coding and have watched 5 tutorials before yours and always walked away with more questions than answers. Your video really helped me out and was easy to understand. Thanks for teaching; you have a gift!

davidlipscomb
Автор

I had loads of fun doing this. Great first project.

msgnomi
Автор

Thank you for helping me pass my programming final!!

hadenjohnston
Автор

thanks to this game i find interesting learn python.

stereotipo
Автор

Omg thanks soo much I was struggling with this I’m so happy that I can do this now

chesspieceface
Автор

Or you can just type .lower().strip() instead of typing "or roll_again == 'blabla'" ... Faster and cleaner

hayatisilimya
Автор

THANK YOU SO MUCH.
Look. I have a problem.
I want Make a code that the score is calculated and outputs the points.
for example, if i rollded a 5, it will output that i have a poin and that will add to a total score.
help me with this.
YOUR THE BEST

yusufsheikh
Автор

I have a problem on again part at the beginning and I don't know how to change it, could you please help me.

chrisivanov
Автор

i ama not getting output while iam giving y or yes error is showing

dasarispandana
Автор

this is my rock paper scissors on python you can copy the code
input ("Lets play rock paper scissors! ")
def main():
from random import randint
rpsChoices = ["rock", "paper", "scissors"]
rpsP = input("rock, paper, or scissors?: ")
rpsC = rpsChoices[randint(0, 2)]

print("You chose", rpsP)
print("The computer chose", rpsC)
if rpsC == rpsP:
print("You tied. Well you had luck.")
elif rpsC == "paper" and rpsP == "rock" or rpsC == "rock" and rpsP == "scissors" or rpsC == "scissors" and rpsP == "paper":
print("You lose. YAY I BEAT YOU. YOU SUCK.")
elif rpsC == 'paper' and rpsP == 'scissors' or rpsC == 'rock' and rpsP == 'paper' or rpsC == 'scissors' and rpsP == 'rock':
print("You win. How did you beat me? You probably cheated >:(")
input (" Did you cheat or not? Be honest ")
input (" Stop lying you cheated ")
input (' STOP LYING IF YOU LIE ILL COME AND FIND OUT WHERE YOU LIVE AND KIDNAP YOU AND THEN WE WILL go to the ice cream shop! :D ')
input (' Fine fine you won and didnt cheat. BUT THAT WAS JUST LUCK NO ONE BEATS THE COMPUTER ')

main()


enjoy! :D

abtinaryanpour
Автор

For my issue when I type in

import random
import time


roll_again = "yes"

while roll_again == "yes" or roll_again == "y":
print("We are now rolling the dice...")
time.sleep(1)

dice1 = random.randit (1, 6)
dice2 = random.randit (1, 6)

print("The values are:")
print("Dice 1 =", dice1, "Dice2 =", dice2)

if dice1 == dice2:
print("You rolled a double!")
else:
print("Keep trying!")
roll_again = input("Roll the dice again? (Y/N) ")

The problem code I end up getting is that "module" object has no attribute 'randit'

sebastiantorres
join shbcf.ru