Skip to content

Instantly share code, notes, and snippets.

@KingDarBoja
Created September 25, 2018 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KingDarBoja/a8fc9fe63e0f4f4a4aa5290658d2c961 to your computer and use it in GitHub Desktop.
Save KingDarBoja/a8fc9fe63e0f4f4a4aa5290658d2c961 to your computer and use it in GitHub Desktop.
Custom hello world program with colorfull words in the terminal using colorama module.
# -*- coding: utf-8 -*-
"""Custom hello world by KingDarBoja.
Python script to output the classic 'hello world' message using colorama.
To install it, use 'pip install colorama' on the command line.
"""
# Import the colorama module
from random import randint
from colorama import init, Fore
init()
# Print 'hello world' in a colorful way.
words = 'hello world'
colors_list = [a for a in dir(Fore) if not a.startswith('__')]
for word in words:
print(getattr(Fore, colors_list[randint(0, len(colors_list)-1)]) + word,
end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment