Python Forum
5 mini programming projects for the python beginner
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
5 mini programming projects for the python beginner
#5
You can create a list with colors and number and use randrange function. Here is the sample program which I tried myself.
import random #import random function
input('Press any key to roll your Dice:')
color=['Red','Blue','Green','yellow','Pink','Black'] #declaring list of 6 colors of 6 sides.
op=random.randrange(1,7) #selecting random number from 1 to 6
op1=random.choice(color) #selecting random color from color list

print("Your Dice is",op1,"colour with number",op) #printing the output.
Reply


Messages In This Thread
RE: 5 mini programming projects for the python beginner - by VeenaReddy - Sep-26-2017, 02:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Visual Python Programming flows Joost 0 2,673 Jun-06-2021, 06:51 AM
Last Post: Joost
Photo All 31 of my Python projects with source code steve_shambles 2 4,145 Mar-23-2020, 12:08 AM
Last Post: steve_shambles
  Guess the dice roll mini-game tawnnx 6 7,319 May-22-2018, 02:12 PM
Last Post: malonn
  My first python projects (help with reviews and opinions) wilfredinni 0 9,030 Mar-06-2018, 02:33 PM
Last Post: wilfredinni
  Use this integer and string encrypter and decrypter module in your projects Unlimiter 4 4,257 Jan-05-2018, 11:32 AM
Last Post: Unlimiter
  Mini-Web Framework nilamo 12 9,693 Jun-15-2017, 05:32 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020