-
If the heart rate is below 60 or above 100, then activate the ICU alarm.
heart_rate = 45 if heart_rate < 60 or '': print('Activate the ICU alarm!')
-
This code determines the mortgage eligibility based on income and credit score. What will be the value of the eligibility variable?
income = 50000 credit_score = 900 if income >= 50000 and credit_score >= 700: eligibility = "Eligible" elif income >= 40000 and credit_score >= 650: eligibility = "Partially Eligible" else: eligibility = "Not Eligible" print(eligibility)
-
This code determines the mortgage eligibility based on income and credit score. What will be the value of the eligibility variable?
income = 90000 credit_score = 900 if income >= 50000 and credit_score >= 700: eligibility = "Eligible" elif income >= 40000 and credit_score >= 650: eligibility = "Partially Eligible" else: eligibility = "Not Eligible" print(eligibility)
-
This code determines the mortgage eligibility based on income and credit score. What will be the value of the eligibility variable?
income = 35000 credit_score = 1200 if income >= 50000 and credit_score >= 700: eligibility = "Eligible" elif income >= 40000 and credit_score >= 650: eligibility = "Partially Eligible" else: eligibility = "Not Eligible" print(eligibility)
-
What does the condition of the if statement mean?
product_code = '100001' if product_code.isdigit() and len(product_code) == 6: print("Valid product code.") else: print("Invalid product code. Please enter a numeric value.")
Python Exercises for Conditionals
If you've faced difficulties with these exercises, take a look at Conditionals Module on my Python course.
You can also share 'Python Conditionals' Exercises on your:
X (Twitter) - Telegram - Linkedin - Facebook - or on your favorite platform...