Objective
Create a Python program that prompts the user for two numbers and responds whether they are positive or if both are positive, using the conditional operator.
Instructions
- Prompt the user for a number and store it in a variable named
a. - Prompt the user for another number and store it in a variable named
b. - Use the conditional operator to evaluate if
ais positive and displayA is positiveorA is not positivebased on that evaluation. - Use the conditional operator to check if
bis positive and displayB is positiveorB is not positivebased on that evaluation. - Finally, use the conditional operator to determine if both numbers are positive and display
Both are positiveorBoth are not positiveas appropriate.
6
4
A is positive
B is positive
Both are positive
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise