Python Beginner Programs
Beginner‑Friendly Loop
colors = ["\033[91m", "\033[92m", "\033[93m", "\033[94m", "\033[95m", "\033[96m"]
text = "PYTHON"
for i, letter in enumerate(text):
print(colors[i] + letter, end="")
print("\033[0m") # reset color
Beginner Menu Example
print("\033[96m=== Python Menu ===\033[0m")
print("\033[92m1. Start\033[0m")
print("\033[93m2. Help\033[0m")
print("\033[91m3. Exit\033[0m")
Greeting Program
name = input("\033[94mWhat is your name? \033[0m")
print("\033[92mHello,", name + "! Welcome to Python.\033[0m")
Emoji (Beginner‑Safe)
print("\033[95mLearning Python is fun! 🚀\033[0m")
print("\033[96mKeep going — you’ve got this! 💡\033[0m")
Simple Calculator (Beginner Input Example
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
print("Sum:", num1 + num2)
print("Difference:", num1 - num2)
print("Product:", num1 * num2)
print("Quotient:", num1 / num2)
Random Number Guessing Game
import random
secret = random.randint(1, 10)
guess = int(input("Guess a number between 1 and 10: "))
if guess == secret:
print("You got it!")
else:
print("Not quite. The number was", secret)
We participate in the Amazon Services LLC Associates Program and may earn fees by linking to Amazon and affiliated sites.
© 2026. All rights reserved.
