Challenge 9 – Hows the temperature?
- Ask the user the temperature and convert the temperature to an integer.
- If the temperature is above 30 degrees, tell the user it is hot today
- If the temperature is below 5 degrees, tell the user the it is cold.
- Use the os.system(‘clear’) function to add system clears to your program.
- If the user enters any amount outside of the valid range ( – 50c ./ + 50c) , they should be told that they have entered an invalid value.
Challenge 10 – Calculate the area of a rectangle.
- Ask the user to enter the length and width of a rectangle.
- Convert the inputs to integers.
- Output the area of the rectangle.
- Use the .strip() method to remove spaces before and after the user’s input.
- Also calculate the circumference of the rectangle and output the circumference as well.
- Ask the user to enter the lengths and widths of 2 rectangles.
- Calculate the area of both and output which rectangle is higher.
Challenge 11 – Calculate the missing triangle angle
The angles of a triangle always add up to 180 degrees.
- Ask the user to enter 2 angles of a triangle and convert the values to integers
- Work out the third angle and output it to the user.
Check each of the values entered to ensure that they are valid ( less than 180 degrees in total) and print out an appropriate response if they don’t enter a valid amount.
- Check the values entered and calculated to work out of the triangle if the triangle is either:
- Equilateral – All angles equal size.
- Isosceles – Two angles equal size.
- Scalene – All angles of different size.
- Print out an appropriate amount.
Challenge 12 – Reaction Timer Game
Create a program that tests the user’s reaction time.
*** To complete this challenge you need to watch the advanced tutorial ***
- Get the program to wait a random amount of seconds and then ask the user to press enter.
- Record the time the message was displayed and the time the user pressed enter. Work out the response time and print it out to the user.
- use the round() function to convert the user’s float to 2 decimal places.
- If the user took less the 0.1 seconds, tell them well done.
- If the user took longer than 0.5 seconds, tell them their reaction time is too slow.