Using Nested If Function Python Definition