In this series of challenges, you'll practise writing functions, using input() to get information from the user, working with lists, and returning results as strings.
A shared list called tools is used across many of the tasks. This list represents the robot’s available tools, and you will use it to:
Show the tools,
Count how many tools the robot has,
Add new tools,
Search for a tool,
Loop through and activate tools.
Each challenge helps you practise a different skill such as:
Combining input with string outputs
Using if statements
Looping through lists
Modifying and accessing list data
Returning information instead of printing it directly
You must:
Define a function with the correct name
Use the tools list where needed
Use input() to ask the user something
Return a string as the result (do not use print() inside the function)
These tasks are a fun way to practise basic Python skills while building simple robot programs!
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def greet_user():
name = input("What is your name? ")
return f"Hello, {name}! Tools: {tools}"
print(greet_user())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def generate_robot_name():
colour = input("Enter a colour: ")
animal = input("Enter an animal: ")
return f"Robot Name: {colour} {animal}. Tool count: {len(tools)}"
print(generate_robot_name())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def check_battery():
level = int(input("Battery level: "))
if level < 20:
return "Battery low!"
else:
return f"Use this tool: {tools[0]}"
print(check_battery())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def search_tool():
tool = input("Tool to search: ")
if tool in tools:
return "Tool found."
else:
return "Tool not found."
print(search_tool())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def track_location():
location = input("Robot location: ")
return f"Location: {location}. Tools: {tools}"
print(track_location())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def power_up_tools():
answer = input("Power up? (yes/no): ")
if answer == "yes":
result = ""
for tool in tools:
result += f"{tool} powered up.\n"
return result.strip()
else:
return "No power up."
print(power_up_tools())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def emergency_shutdown():
answer = input("Emergency? (yes/no): ")
if answer == "yes":
tools = []
return "Shutdown complete."
else:
return "No shutdown."
print(emergency_shutdown())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def add_tool():
new_tool = input("New tool: ")
tools.append(new_tool)
return f"Added: {new_tool}. Tools: {tools}"
print(add_tool())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def show_tool_summary():
answer = input("Show summary? (yes/no): ")
if answer == "yes":
result = f"{len(tools)} tools:\n"
for i, tool in enumerate(tools, 1):
result += f"{i}. {tool}\n"
return result.strip()
else:
return "No summary."
print(show_tool_summary())
# Shared tools list
tools = ["Laser", "Wrench", "Camera", "Drill", "Scanner"]
def mission_summary():
name = input("Robot name: ")
location = input("Location: ")
return f"{name} is at {location}. Tools: {tools}"
print(mission_summary())