top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Roll A Die

Writer: Rohit RoyRohit Roy

The idea is to play die game using python.To do so we will take help from "Random Library". Random Library will allow us to generate random values which is defined within the limits of user to do so.

Step 1.Import Random Library import random Step 2. Define a Variable

x = "y"

Step 3. Use a loop to define the limits of the values for random function

while x == "y": num = random.randint(1,6)

Step 4. Terminate the loop at users will x=input("Press Y to roll again and N to exit:")


Application

Hence by doing this we will able to play any game which uses die.For example you need next number for snake and ladders is 3 and below is the output which you will see.

[-----] [ ] [0 0 0] [ ] [-----]

Click on the image to check the code.


 
 

1 Comment


Data Insight
Data Insight
Sep 19, 2021

What does your code do? Give an example of the use of your code.

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