Explore
Courses
Batches
Sketches
Statistics
Code a Pookkalam
Jobs
Devsprint
People
Course Creation
Create a Course
Guidelines
Resources
Support
Blogs
My Profile
About Us
Login
Sketches
3
DICE(It shows random values)
By
Amal Jyothi S
Run
def dot(x,y): return circle(r=10,fill="black",x=x,y=y) def dice_dot(): rnd=round(random(1,6)) if rnd==1: return dot(0,0) elif rnd==2: return dot(-25,25)+dot(25,-25) elif rnd==3: return dot(-25,25)+dot(25,-25)+dot(0,0) elif rnd==4: return dot(-25,25)+dot(25,-25)+dot(25,25)+dot(-25,-25) elif rnd==5: return dot(-25,25)+dot(25,-25)+dot(25,25)+dot(-25,-25)+dot(0,0) elif rnd==6: return dot(-25,25)+dot(25,-25)+dot(25,25)+dot(-25,-25)+dot(25,0)+dot(-25,0) show(rectangle(w=300,h=300,fill="black"),rectangle(w=100,h=100,fill="white"),dice_dot()) print("CLICK ON RUN TO THROW THE DICE AGAIN")
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login