Practice

Hours

Write a program that asks the user how many hours they spend on the internet per day and print if they're addicted or not based on the hours. (5 or more hours is addicted, less than that is not addicted).

<aside> 💡 For a challenge, see if you can write the same program, except that the user is addicted to the internet if the number of hours that they spend on the internet is greater than 2 times the remainder of hours / 7

</aside>

💻 Template code

✅ Solution code

Difference

Write a Python program that prompts the user to enter a number. If the number is greater than 17, print "Negative". Otherwise, print the result of 17 minus the given number.

💻 Template code

✅ Solution code

Grade

Write a program that asks the user to enter the score for a student's test. Print the letter grade that the test score receives.

<aside> 💡 For a challenge, see if you can write the same program, but without using >= anywhere.

</aside>

💻 Template code

✅ Solution code

Sum Compare

Get 3 numbers from the user. Find the biggest number, then add all the numbers together. If the sum is bigger than 2 times the biggest of the 3 numbers, print the sum. If it's smaller, multiply the sum by 3 and print the product.

💻 Template code

✅ Solution code

Four Numbers

Ask the user for 4 numbers. Use only 3 if/else blocks to find the largest number. You may not use elifs. For example, this counts as one if/else block

if (2 > 3):
	print("yay")
else:
	print("nay")

This question is really tricky and requires some ingenuity