LEARN Python - 1.6 Mini Project - The Compliment Machine - zerotopyhero.com
LEARN Python - 1.6 Mini Project - The Compliment Machine - zerotopyhero.com

Learn Python – 1.6: Mini Project – The Compliment Machine

Your First Fully Interactive Python Program

You made it through Step 1 with variables, numbers, strings, input, comments, and f-strings.
Now it’s time to combine those skills into your first “real” little program.

We’re building The Compliment Machine: a friendly script that asks the user some questions and then generates a fun, personalized compliment.

No logic.
No conditions.
No advanced tricks.
Just everything you already know, used together for the first time.

Step 1: Ask the User Some Fun Questions

We’ll gather a few details so the compliment feels personal.

				
					# Ask the user for their name
name = input("What's your name? ")

# Ask for their favorite color
color = input("What's your favorite color? ")

# Ask for their favorite animal
animal = input("Name an animal: ")

# Ask for their age
age = input("How old are you? ")
				
			

Step 2: Light Cleanup (Just Using What You Know)

We can make the input look nicer with the string methods we already learned:

				
					# Clean the input a bit
name = name.strip().title()
color = color.strip().lower()
animal = animal.strip().lower()
age = age.strip()

				
			

Still no logic.
Just tidy text.

Step 3: Build the Compliment

Time to let Python flatter the user like it’s the friend everyone needs.

				
					# Build a fun, personal compliment
compliment = (
    f"Wow, {name}! At {age} years old, you give off strong {color} energy. "
    f"If you were a {animal}, you'd definitely be the legendary hero of the forest!"
)
				
			

Time to let Python flatter the user like it’s the friend everyone needs.

Step 4: Print It with Style

				
					# Print the final compliment
print()
print(compliment)
print("Keep shining, you're doing great!")
				
			

Full Program: The Compliment Machine

				
					# Ask the user for their name
name = input("What's your name? ")

# Ask for their favorite color
color = input("What's your favorite color? ")

# Ask for their favorite animal
animal = input("Name an animal: ")

# Ask for their age
age = input("How old are you? ")

# Clean up the input so it looks nice
name = name.strip().title()
color = color.strip().lower()
animal = animal.strip().lower()
age = age.strip()

# Create the compliment
compliment = (
    f"Wow, {name}! At {age} years old, you give off strong {color} energy. "
    f"If you were a {animal}, you'd definitely be the legendary hero of the forest!"
)

# Print the compliment
print()
print(compliment)
print("Keep shining, you're doing great!")

				
			
ZeroToPyHero