Climate Quest - Task 1
Objective
The objective of this task is to introduce you to the basic concepts of programming in Python, including variables, output to the screen using print()
, and input from the keyboard using input()
. You will create the initial part of the "Climate Quest" game, where the game starts with an introduction and displays a simple menu.
Learning Outcomes
By the end of this task, you should be able to:
- Declare and use variables.
- Use the
print()
function to output text to the screen. - Use the
input()
function to get user input from the keyboard.
Task Description
You will write a Python program that:
- Welcomes the player to the "Climate Quest" game.
- Asks the player for their name.
- Stores the player's input in a variable.
- Displays a welcome message including the name of the player.
Steps to Complete the Task
-
Welcome Message:
- Use the
print()
function to display the title of the game - Use the
print()
function to display a welcome message for the game.
- Use the
-
Get User Input:
- Use the
input()
function to ask the player for their name. - Store the player's input in a variable.
- Use the
-
Display Welcome Message with City Name:
- Use the
print()
function to display a welcome message that includes the name of the player entered by the player.
- Use the
Only open this section if really stuck
Exercise
-
Start a New Python File:
- Open your Python editor or an online Python compiler.
- Create a new file and save it as
climate_quest.py
.
-
Write the Code:
- Write the code to meet the specification
- Make sure to test your code after each step to ensure it works correctly.
-
Enhance the Welcome Message:
-
Modify the welcome message to include more details about the game. For example:
-
-
Test Your Program:
- Run your program to ensure that it correctly asks for the name of the player and displays the welcome message with the player's name.
Questions for Reflection
- What is the purpose of using variables in a program?
- How does the
input()
function work in Python? - Why is it important to test your code after writing each part?
Extension Activity (Optional)
- Experiment with different welcome messages and inputs.
- Try using different variable names and see how it affects your program.