Sunday, July 30, 2017

Random Color Codes in Python


import random color=[] #Generate 20 random color codes for i in range(21): r = lambda: random.randint(0,255) color.append('#%02X%02X%02X' % (r(),r(),r())) # print all 20 color codes.... for color in color: print(color) """ Result............... #C08974 #F3C0AF #CC7F9C #4D9D02 #B571E2 #6E8FA1 #5780D7 #370C07 #A25945 #68DD14 #407A37 #F1FF55 #1F7C62 #26A957 #171535 #57E358 #20F1F3 #0F9F5B #E5BA16 #428AAC #3D942C """

No comments:

Post a Comment