## Blog Detail

### Python Conditionals Exercises

• What will be the value of the shipping_cost variable?

```                ```destination_zone = "Zone C"

if destination_zone == "Zone A":
shipping_cost = 10.0
elif destination_zone == "Zone B":
shipping_cost = 15.0
elif destination_zone == "Zone C":
shipping_cost = 20.0
else:
shipping_cost = 25.0

print("The shipping cost to", destination_zone, "is:", shipping_cost)``````
• What will be the value of the shipping_cost variable?

```                ```destination_zone = "Zone E"

if destination_zone == "Zone A":
shipping_cost = 10.0
elif destination_zone == "Zone B":
shipping_cost = 15.0
elif destination_zone == "Zone C":
shipping_cost = 20.0
else:
shipping_cost = 25.0

print("The shipping cost to", destination_zone, "is:", shipping_cost)``````
• How much will be the tax_percent ?

```                ```income = 50000

if income <= 10000:
tax_percent = 0
elif income <= 50000:
tax_percent = 10
elif income <= 100000:
tax_percent = 20
else:
tax_percent = 30

print(tax_percent)``````
• What will be the value of the password_strength variable?

```                ```password = "Abc123!"

if len(password) < 6:
elif len(password) < 10:
else:

• What will be the value of the password_strength variable?

```                ```password = "Abc123!@45"

if len(password) < 6:
elif len(password) < 10:
else:

• This code determines the discount amount based on the customer's loyalty level.
What will be the value of the discount_percent variable?

```                ```loyalty_level = "Gold"

if loyalty_level == "Silver":
discount_percent = 5
elif loyalty_level == "gold":
discount_percent = 10
elif loyalty_level == "Platinum":
discount_percent = 15
else:
discount_percent = 0

print(discount_percent)``````
• This code determines the shipping fee based on the country of delivery.
How much will be the value of the shipping_fee variable?

```                ```country = "UK"

if country == "USA":
shipping_fee = 10.0
elif country == "Canada":
shipping_fee = 15.0
elif country == "uk":
shipping_fee = 12.0
elif country == "Australia":
shipping_fee = 18.0
else:
shipping_fee = 20.0

print(shipping_fee)``````
• ## 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...

Happy Coding!
Behnam Khani