all AI news
If Else In Python
June 16, 2024, 8:55 a.m. | pulkitgovrani
DEV Community dev.to
We require decision making whenever we want to execute certain part of code only if the condition is satisfied. So if, elif and else are used for decision making in python.
Basic Example
A person is allowed to drive a car if he/she is more than 18 years old else he cannot drive the car.
Code:
Input 1:
18
Output 1:
You are eligible to drive a car
Input 2:
16
Output 2:
You cannot drive a car
More Complex …
basic beginners car code computerscience cschallenge decision decision making devchallenge drive example making part person python
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
AI Focused Biochemistry Postdoctoral Fellow
@ Lawrence Berkeley National Lab | Berkeley, CA
Senior Data Engineer
@ Displate | Warsaw
Lead, Sales Operations Strategy EMEA - 12 Month Fixed Term Contract
@ Snap Inc. | London - 50 Cowcross Street
Senior Staff Engineer- Observability and Reliability Platform Engineering (REMOTE)
@ GEICO | MD Chevy Chase (Office) - JPS
Senior Manager, Software Quality Assurance
@ IQVIA | Ottawa, Ontario, Canada
Associate, Software Application Engineer
@ BlackRock | MU8-South (A) Wing, 7-10 Floor, Nesco IT Park Tower 4, Western Express Highway, Mumbai