More complicated tasks!

Skip to content

This here’s a machine-translated text that might contain some errors!

Task 1 - “Login” | Easy

Build a simple program that asks the user for a password. If the password matches the correct one, then the program prints out a message.

Tip: Store the right password in a variable and compare against it.

Example Printout
Write password: password123
That's the right password!
Tips on how to proceed
  • How to get input from the user 👉 Python Intro
  • How to check if the text matches something.
  • You gotta use if here.
  • Feel free to use else to print out when the password doesn’t match.

Task 2a | Easy

Ask the user for a color, then print out a message based on which color they picked.

Add at least 4 colors to check. Examples: Red, Green, Blue, Yellow

Example Output
Enter a color: red
Red is a warm color!
Howdy on how to tackle this here
  • How you reckon if that yonder text matches up with somethin’.
  • You gotta use if, elif, and else for that job.
  • Tip: Don't forget ya can stack more than oneelif`.

Task 2b | Medium

One thing worth considerin’ is that, fer a computer

Change the code so it works no matter what ya type in fer the color.

Example: Ya type røD, still gettin’ the message fer red.

New concept! The lower() function!

To solve this you gotta use something that ain’t mentioned in Level 1:

lower(). This here function turns all the text into “lowercase”, meaning just small letters.

You can use it like so:

teks = "hELlo WoRLD!"
sma_boekstavas = teks.loweR()
print(sma_boekstavas) # prints out "HELLO WORLD!"

There’s also UPPER( ) to make everything BIG LETTERS.

Example Output
Enter a color: ReD
Red is a warm hue!
Tips til framgangsmåte
  • After ya’ve wrangled the text from the user, turn it all into lowercase first before ya check them colors.

Task 3 | Medium

Is it hot outside or is it cold outside? Ask the user for a temperature in Celsius. Then give a message based on whether it’s hot or cold.

Example Printout
What's the temp: 30
It's hot out there!
Hints on how to proceed
  • How to get numbers from the user 👉 Python Intro
  • Checkin’ if a number’s higher than or lower than a certain value. 👍 Python Conditions

Task 4 - Compare two numbers | Medium

Build a program that asks the user for two numbers. Compare these two numbers with each other and give a message about which is greater—the “first” number or the “second.”

tips on how to proceed

  • How do we compare two variables?*

Task 5 - Is it the weekend? | Hard

Write a program where you ask the user for a day of the week, then check if it is the weekend or not. Print a message if it’s the weekend, or a message if it isn’t the weekend!

New concept! The or keyword!

In this task, it might be handy to whip out that or. We ain’t talked about this yet, but it’s easy as pie!

You can use this one to compare two things at once!

if number == 2 or number == 3:
    print("That's right on the money!")

There’s also an and, where both conditions gotta line up together for it to work.

Example Printout
Type a day of the week: Saturday
It's the weekend! Yeehaw!
Extra challenge

You can tackle this with just an if and an else. How’d you pull that off? 🤠

Task 6 - Grading System | Hard

Write a program that takes a score between 0 and 100 and returns a “Grade”.

Score Grade
Above 90 6
Between 75 and 89 5
Between 60 and 74 4
Between 50 and 59 3
Between 40 and 49 2
Below 40 1
Tips til framgangsmåte
  • How do we check if a number is over a certain value?
  • Hint: We never need to check if a value is under a given value here, as long as you check in order from the highest character to the lowest.

Task 7 - Simple Calculator | Medium

Ask the user for two numbers, then ask for an “operator” to perform the calculation. Start with plus + and minus -. Perform the calculation and print the answer back to the user.

Example Output
Enter a number: 14
Enter another number: 18
Enter an operator: +
The answer is: 32
Tips til framgangsmåte
  • Figure out first, how do we add two numbers together?
  • How do we grab them numbers from the user?
  • How do we add two variables together?
  • Now go on and grab that operator too.
  • How do we check which operator was written down?