top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Dice Rolling Simulator

Writer: mohamed amine brahmimohamed amine brahmi

As the name of the program suggests, we will be imitating a rolling dice, will generate a random number each dice the program runs, and the users can use the dice repeatedly for as long as he wants. When the user rolls the dice, the program will generate a random number between 1 and 6 (as on a standard dice).The number will then be displayed to the user. It will also ask users if they would like to roll the dice again.


import random '''importing random module to generate random numbers''

def rolling_dice(): '''defining rolling_dice function to generate random number between and 6 and return the generated number'''

n = random.randint(1,6)

return print(n)

roll_again = (input("if you want to roll the dice again enter 1 else enter 2 "))

''' ask the user if he wants to roll the dice again '''

if roll_again == '1':

print(rolling_dice())

''' if the user answear yes so the dice is rolled again "'




 
 

1 Comment


Aina Adekunle
Aina Adekunle
Sep 04, 2021

It is difficult to read your code. Perhaps you should take clue from other articles on how to write or embed code in your article.

Like

COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page