Problem 1balance = 20.0price = 19.0overdraft_protection = True#You
Problem 1balance = 20.0price = 19.0overdraft_protection = True#You
may modify the lines of code above, but don’t move them!
#When you Submit your code, we’ll change these lines to
#assign different values to the variables.
#Last exercise, we printed True if balance was greater than or
#equal to price, and False otherwise. However, some banks have
#something called overdraft protection. Overdraft protection
#means that the customer is allowed to spend more than their
#balance, and the bank just expects them to deposit the money
#to cover the purchase later.
#
#rite some code below that will print True if the customer
#can make the purchase given their balance, the purchase
#price, and whether or not they have overdraft protection.
#Specifically, the result should be True if balance is greater
#than or equal to price or if overdraft_protection is True,
#and False if neither of these are true.
print(balance>=price or overdraft_production)
else print(False)
Problem 2
cold = False
windy = False
need_jacket = cold
#You may modify the lines of code above, but don’t move them!
#When you Submit your code, we’ll change these lines to
#assign different values to the variables.
#In this problem, we want to print the message, “You should
#wear a jacket today!” if it’s cold or windy, or the message
#”You don’t need a jacket today!” if it’s not.
#
#At the bottom of this file, we’ve added some code that
#handles printing these two messages. For this code to work,
#the variable need_jacket needs to exist. Its value should be
#True (the boolean, not the string) if it’s cold or windy,
#False if it’s neither cold nor windy.
#dd your code to create the variable need_jacket with the
#appropriate value here!
#Do not modify the code below. It will work if you have
#correctly create the variable need_jacket with the
#appropriate value.
need_jacket = cold
print(need_jacket)
else:
print(False)
Problem 3
mystery_value_1 = 6
mystery_value_2 = 2
#You may modify the lines of code above, but don’t move them!
#When you Submit your code, we’ll change these lines to
#assign different values to the variables.
#Write some lines of code below that will perform the
#following operations in the given order:
#
# – Print the sum of mystery_value_1 and mystery_value_2
# – Print the difference between mystery_value_1 and mystery_value_2
# (mystery_value_1 minus mystery_value_2)
# – Print the product of mystery_value_1 and mystery_value_2
# – Print the quotient of mystery_value_1 and mystery_value_2
# (mystery_value_1 divided by mystery_value_2)
# – Print the modulus of mystery_value_1 and mystery_value_2
# (the remainder of the division operation above)
#
#These operations should not carry forward: each one should
#act on the original values of mystery_value_1 and
#mystery_value_2.
#dd your code here!