Question
Write nested if statements that perform the following tests: If amount1 is greater than 10 and amount 2 is less than $100,$ display the greater of the two.
Step 1
Then, we need to display the greater of the two amounts. Here's the code: ```python if amount1 > 10 and amount2 < 100: if amount1 > amount2: Show more…
Show all steps
Your feedback will help us improve your experience
Willis James and 66 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write an if statement that assigns 20 to the variable y and assigns 40 to the variable z if the variable x is greater than 100. Write an if statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. Write an if-else statement that assigns 0 to the variable b if the variable a is less than 10. Otherwise, it should assign 99 to the variable b. Write nested decision structures that perform the following: If amount1 is greater than 10 and amount2 is less than 100, display the greater of amount1 and amount2.
Tell whether the inequalities are equivalent. Explain your reasoning. $$ 20 b \geq-2 ; b \leq-\frac{1}{10} $$
Solving and Graphing Linear Inequalities
Solving Inequalities Using Multiplication or Division
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD