## Blog Detail

### Python Conditionals Exercises

• Write a condition that checks if the item is affordable.

```                ```item_price = 1900.25
wallet = 2100.50

if '':
print('The item is affordable!')``````
• Hold the result of the comparison in a variable and then use the variable as the condition.

```                ```item_price = 1900.25
wallet = 2100.50

is_affordable = item_price <= wallet

if '':
print('The item is affordable!')``````
• If the user wants to rent a car for more than 30 days, announce to the user that they are eligible for a 15% discount.

```                ```rent_days = 34

if ''
print('You are eligible for a discount of 15% on your order.')``````
• Check if the file size exceeds the maximum allowable size for uploading.

```                ```file_size = 10     # 10 MB
max_file_size = 5  # 5 MB

'' file_size > max_file_size:
print('File size exceeds the maximum allowable limit.')
• Check if the file size exceeds the maximum allowable size for uploading.

```                ```file_size = 2      # 2 MB
max_file_size = 5  # 5 MB

if file_size > max_file_size:
print('File size exceeds the maximum allowable limit.')
'':
• This code verifies the password and confirm password entered by the user.
What will be the output of this program?

```                ```password = "SecurePassword123"

else:
• Based on the app logic, a valid product code contains only digits.
Write an if condition that checks if the given product code is valid or not.

```                ```product_code = '1001'

if ''
print("Valid product code.")
else:
print("Invalid product code. Please enter a numeric value.")``````
• This code verifies the password and confirm password entered by the user.
What will be the output of this program?

```                ```password = "SecurePassword123"

else:
``````
• ## 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: