6 Comments

import random

message="You rolled a"

print("Rolling the dice")

print(message,random.randint(1,6))

Expand full comment

can we upgrade this code to make a software randomgenarator from 1-100 with UI?

Expand full comment

import random

dice_roll_user = random.randint(1, 6)

dice_roll_computer = random.randint(1, 6)

if dice_roll_user > dice_roll_computer:

print(f'You won the computer! You rolled a {dice_roll_user} and the computer rolled a {dice_roll_computer}.')

elif dice_roll_user == dice_roll_computer:

print(f'You tied with the computer! You rolled a {dice_roll_user} and the computer rolled a {dice_roll_computer}.')

else:

print(f'You lost for computer! You rolled a {dice_roll_user} and the computer rolled a {dice_roll_computer}.')

Expand full comment

import random

print("Dice Roll " + str(random.randint(1, 6)))

Expand full comment

My solution:

"""

Autor: Juan Sebastian Valencia

Simple Dice Rolling Simulator

Proyecto diario de Dialy Python Projects

Modulo para retornar un numero aleatorio entre 1 y 6

"""

from random import randint

def rolling_simulator():

return f'You rolled a {randint(1, 6)}!'

print(rolling_simulator())

Expand full comment

import random

print(f"You rolled a {random.randint(1,6)}! ")

Expand full comment