You know how Gru can’t plan a heist without intel—vault codes, guard schedules, and obviously how many bananas to pack? Your programs need intel too. That intel comes from users, and Python’s walkie-talkie for that is the input() function. With it, your code pauses, asks a question, and waits for the human to answer. Then you can store that answer in a variable and use it—print it, remix it, or feed it into later logic.
Newest Concept:
input( )
Think of input() like a Minion intercom: “Bee-do! State your mission!” Python displays your prompt, the user types, presses Enter, and you get their text back.
Once Python receives the user’s input, it assigns that input to a variable to make it convenient for you to work with.
message = input("Tell me something, and I will repeat it back")
print(message)
The input() function takes one argument: the prompt that we want to display to the user, so they know what kind of information to enter
In this example:
Python runs the first line
The user sees the prompt Tell me something, and I will repeat it back to you:
The program waits while the user enters their response and continues after the user presses ENTER.
The response is assigned to the variable message
The print(message) displays the input back to the user
Use the input() function to ask the what the minion's name is. Then follow up with:
"What is your favorite color?"
"What is your favorite food?"
"What is your favorite hobby?"
Store the user's responses in separate variables (e.g., color, food, hobby).
Use the print() function to display the answers back to the user. Each response should be printed on a separate line in the format:
"Your favorite color is [color]."
"Your favorite food is [food]."
"Your favorite hobby is [hobby]."
Great prompts are like Dr. Nefario’s lab labels—no mystery goo here.
Remember... You want users to know EXACTLY What they are expected to respond to!
Add a space at the end of your prompts (after the colon in the preceding example) to separate the prompt from the user’s response and to make it clear to your user where to enter their text
You can use \n or \t in order to insert newline or tabs
Sometimes you’ll want to write a prompt that’s longer than one line.
For example, you might want to tell the user why you’re asking for certain input
We can use string concatenation +
prompt = "If you share your name, we can personalize the messages you see."
prompt += "\nWhat is your first name? "
name = input(prompt)
Remember there are other ways!!!!!
TASK 1: Use a multi-line prompt to ask the user for their favorite book and the author. Explain why the information is being requested.
TASK 2: Use a multi-line prompt to ask the user what they would do if they had a perfect day. Guide them through the day by asking questions about the morning, afternoon, and evening
You'll now have a bunch of tasks you need to complete. Do these all as SEPARATE Programs! Additionally, you'll need to use your STRING METHODS from the last lesson!
Make a simple badge using the user’s name and favorite emoji.
Prompt for Name and an Emoji
Display as a fun badge!
Prompts to include (all strings):
codename (“Pick a codename for this mission”)
location (“Where is the mission?”)
objective (“What’s the main objective?”)
gadget (“Name one gadget you’ll bring”)
sidekick (“Which Minion is your sidekick?”
Scarlett Overkill and Vector have tasked the Minions with building their next great gadget, and they need your help! The program will ask for specific details to design the ultimate gadget. Once all the details are provided, the program will display a fun summary of the gadget Scarlett will receive.
Ask the user for the following customization details:
What does the gadget do? (store in function)
How big should the gadget be (in minion-sized units)? (store in size)
What is the power source of the gadget? (store in power_source)
How many gadgets do you need? (store in quantity)
What will the gadget be named? (store in gadget_name)
Store the inputs in separate variables.
Use string formatting to display the final gadget order summary with all the fun details they entered.
You MUST use String Methods at least 5 separate times!!!
Make it look awesome. Banners. Unicode.
“Gru accidentally spilled shrink serum on the official mission briefing, so the Minions need YOU to recreate it! Fill in the blanks and generate a new, totally ridiculous mission.”
If you’ve never played one before: a Mad Lib is a silly game where you ask people for random words (like a name, place, object, adjective, or sound) and then plug those words into a story template.
Because nobody knows the full story until the end, the results are usually absolutely ridiculous.
(Think: “Kevin the minion danced through the volcano carrying a sparkly taco while screaming BEE-DO!”)
You’re going to build your own Mad Lib generator in Python.
You will:
🧠 Ask the user for words using input()
For example: “Enter an adjective” or “Enter a villain’s name”
💾 Store the words in variables
(Each answer should be saved in a variable like adjective, villain, object, etc.)
🖨️ Print out a funny story using f-strings
Plug the user’s answers into a pre-written story
✨ Use string methods to make it pretty
title() for names
upper() to yell words
strip() to clean up input
For students who finish early:
Add extra questions (like a pet’s name, a vehicle, or a snack)
Add a multi-line intro using \n to explain the mission
Use borders or banners ("=" * 40) to style the output
Use .center() to make the title centered like a poster
Example Input:
Example Output: