Skip to main content
Logo image

Section 12.11 Unit 2a Write Code for Toggle Code

90 minutes
This is the selection write code problems associated with the mixed up code problems.

Activity 12.11.1.

Write code that tests guess to see if it is equal to answer or too high or too low. If it is too high as in the example below, it should print out Your guess is too high.

Activity 12.11.2.

Write code that prints You can go out if you don’t have any homework and have cleaned and otherwise prints You can not go out.

Activity 12.11.3.

Write code that tests if x is between 1 and 10, and prints 1 <= x <= 10 or x is not in range.

Activity 12.11.4.

Write code that prints out if the string message has the word ringing in it or not. It should print out Answer the phone! if ringing is in message, and I don't hear anything. if not.

Activity 12.11.5.

Write code that prints if your favorite food is junk food (pizza or wings) or not. Your code should check to see if the variable favFood value is pizza or wings. If it is, it should print out Your fav is junk food. If not, it should print Your fav is not junk.

Activity 12.11.6.

Write code that prints your fine if you are speeding. If you are going over 65 but less than 75, the fine is 50. If you are going at least 75 and less than 85, the fine is 100. Over that the fine is 200. It should not print anything if you are not speeding.

Activity 12.11.7.

Write code that prints the alarm time. If it is a weekday you should get up at 7:00am and if not get up at 10:00am.

Activity 12.11.8.

Write code that prints if you Can text now or Can't text now. You can text if you are not driving and not eating.

Activity 12.11.9.

Write code that prints whether your name Starts with a vowel (a, e, i, o, u) or Starts with a consonant.

Activity 12.11.10.

Write code that prints the letter grade with your score. For a score greater than 90, it should print A. For a score between 80 and 90, it should print B. For a score between 70 and 80, it should print C. For a score between 60 and 70, it should print D. For all other scores, it should print E.

Activity 12.11.11.

Complete the get_mid(str) method in the StringWorker class to return the middle character if the string has an odd number of characters and the middle two characters if the string has an even number of characters. For example, get_mid("way") should return "a" and get_mid("away") should return "wa".
You have attempted of activities on this page.