Andrew K.

asked • 02/02/21

Conditionals_TwoWay_MultiWay

Write TwoWay and/or MultiWay IF statements for each below. Submit one .py file.

Please be sure to have blank lines between the IF statements.

 

– If integer variable currentNumber is odd, change its value so that it is now 3

times currentNumber plus 1, otherwise change its value so that it is now half of

currentNumber (rounded down when currentNumber is odd).

 

– Assign true to the boolean variable leapYear if the integer variable year is a

leap year. (A leap year is a multiple of 4, and if it is a multiple of 100, it must

also be a multiple of 400.), otherwise assign false to the boolean variable leapYear

 

– Assign a value to float variable cost depending on the value of integer variable

distance as follows:

 

Distance                                                         Cost

------------------------------------------------------------------

0 through 100                                                5.00

More than 100 but not more than 500         8.00

More than 500 but less than 1,000              10.00

1,000 or more                                               12.00


1 Expert Answer

By:

Patrick B. answered • 02/02/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.