Python Conditional Statements Worksheet
Python Conditional Statements Worksheet
A balance of 25,000 with no bonus results in a total_balance of 25,000, which qualifies for the highest interest rate of 5% if conditions follow the provided logic .
With a purchase of 600 and a discount of 100, the total amount is 500. The condition total_amount >= 500 activates the offer '10% off on next purchase' because the total amount meets this criterion .
An adjust of -70 results in a final speed reduction below safe thresholds defined, thus outputting 'Safe speed' for drastic slowdowns in speed assessments to even within broad safety margins, highlighting system flexibility in managing excessive adjustments .
The keyword 'elif' is used to manage multiple conditions sequentially by checking various branches after an 'if' statement .
The advice will be 'Stay warm with woolens' as the current_temp is 13, which is less than 15, activating the condition to stay warm .
The output is 'Sneha result: Pass'. The total is 55, meeting the condition for passing (total >= 50).
The advice will be 'Wear sunglasses' as the current temperature would be 25. The condition current_temp >= 25 triggers the 'Wear sunglasses' advice .
A 'Free delivery' offer is given when total_amount is 300 or more but less than 500. This is the outcome of the condition elif total_amount >= 300 .
Using extra = -10, the current_temp decreases by 10, potentially changing advice unexpectedly when negative adjustments are not anticipated. The remaining logic still technically holds, as conditions adapt to any number, maintaining function but possibly misaligned user expectation .
With an age of 61 and extra 0, final_age is 61, meeting the criterion for 100 ticket price, marking amended pricing logic for senior tickets as per defined age thresholds .