Advertisement
uottawamakermobile

Hex Colour Generator with for loops

Apr 6th, 2020
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. from random import choice ## random is a module and choice is a function
  2.  
  3. hex_chars = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'] ## create the list of characters from which to choose
  4. colour_code = '#' ## this is the start of any colour code in python
  5.  
  6. for i in range (0,6):
  7.     colour_code = colour_code + choice(hex_chars)
  8.  
  9. print ('The hexadecimal colour code generated is:' ,colour_code)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement