Python

5 Python Conditional Statement 4 – If..else..elif

If..else..elif If..else..elif : code if person_age < 4: ticket_price = 0elif person_age < 18: ticket_price = 5elif person_age < 65: ticket_price = 10else: ticket_price = 5 Python does not require an else block at the end of an if-elif chain. Sometimes an else block is useful; sometimes you can avoid using.

Advertisements
Python

5 Python Conditional Statements 3 – Condition operators or symbols

Condition symbols or operators Operators evaluation: 1) == Equal to operator - True when matches - False when don't match.CASE == CASE (matches and True in this case)Name = 'Vijay'Name == 'vijay' (False)Age = 18Age == 18 (True) 2) != not equal to operator - True when matches - False when don't match. CASE !=… Continue reading 5 Python Conditional Statements 3 – Condition operators or symbols