Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. The following code contains several nested if-else statements. Unfortunately, it was written without proper alignment and indentation. Rewrite the code and use the proper

image text in transcribed
image text in transcribed
4. The following code contains several nested if-else statements. Unfortunately, it was written without proper alignment and indentation. Rewrite the code and use the proper conventions of alignment and indentation. if score >- A_score: print('Your grade is A.') else: if score >- B_score: print('Your grade is B.') else: if score >= C_score: print('Your grade is C.') else: if score >-D_score: print('Your grade is D.) else: print('Your grade is F.) 5. Write nested decision structures that perform the following: If amount1 is greater than 10 and amount 2 is less than 100 , display the greater of amount1 and amount 2 . 1. Number Analyzer Write a program that asks the user to enter an integer. The program should display "Positive" if the number is greater than 0 , "Negative" if the number is less than 0 , and "Zero" if the number is equal to 0 . The program should then display "Even" if the number is even, and "Odd" if the number is odd. 2. Areas of Rectangles The area of a rectangle is the rectangle's length times its width. Write a program that asks for the length and width of two rectangles. The program should tell the user which rectangle has the greater area, or if the areas are the same. 3. Quarter of the Year Write a program that asks the user for a month as a number between 1 and 12 . The program should display a message indicating whether the month is in the first quarter, the second quarter, the third quarter, or the fourth quarter of the year. Following are the guidelines: - If the user enters either 1,2 , or 3 , the month is in the first quarter. - If the user enters a number between 4 and 6 , the month is in the second quarter. - If the number is either 7,8 , or 9 , the month is in the third quarter. - If the month is between 10 and 12 , the month is in the fourth quarter. - If the number is not between 1 and 12 , the program should display an error. 4. Roman Numerals Write a program that prompts the user to enter a number within the range of 1 through 10 . The program should display the Roman numeral version of that number. If the number is outside the range of 1 through 10 , the program should display an error message. The following table shows the Roman numerals for the numbers 1 through 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

Who should be included?

Answered: 1 week ago

Question

1. Explain why evaluation is important.

Answered: 1 week ago