0

why we you if and else in python

17th Mar 2023, 6:52 PM
Abdul Rehman shabu
Abdul Rehman shabu - avatar
2 Answers
+ 8
Abdul Rehman shabu , It is to check conditions... Go through python courses for better understanding... for example, a=1 if a==1: print ('true') else: print ('false') if first condition satisfied statement inside that condition block will be executed or the other statement will be executed
17th Mar 2023, 7:01 PM
Riya
Riya - avatar
+ 6
Abdul Rehman shabu , > see this 2 short sololearn tutorials about if... elif... else... > you should also start learning from the regular python tutorials. this covers all about your requested item. https://www.sololearn.com/learn/Python/2277/?ref=app https://www.sololearn.com/learn/Python/2278/?ref=app
17th Mar 2023, 9:46 PM
Lothar
Lothar - avatar