Posts

Showing posts with the label If Elif Else

Python Tutorial 13 --- "Short Hand If Else Notation In Python"

 Python Tutorial 13 --- "Short Hand If Else Notation In Python" This PROGRAM or TUTORIAL about Python's  "Short Hand If Else Notation In Python" DOC Before going through the if-else short-hand statement, we must be familiar with the basic definition, so we know what the short-hand statement actually is. In basic English, shorthand can be said as “a basic way of writing using abbreviations or symbols”. For example, we do not use the full name, Kentucky Fried Chicken, instead we use its abbreviation that is KFC. Writing in such a compact manner is known as shorthand. Now let us move towards the definition of shorthand with respect to the Python language. “An executable statement, written in so compact manner that it comprises of only a single line of code is known as shorthand statement.” Python supports many sorts of shorthand statements and with the help of these statements, we can write our code in a more compact sort or form using less space. We learned the or...

Python Quiz 2 - "Using if, elif statements to see if you're eligible to drive or not"

 Python Quiz 2 - "Using if, elif, else statements to see if you're eligible to drive or not" CODE print ( "Your age is?" ) var2 = int ( input ()) if var2<= 7 : print ( "Age is definetly not eligible for driving" ) elif var2< 18 : print ( "No. You can not drive." ) elif var2== 18 : print ( "We will think about you and you have to come here for inspection." ) elif var2>= 70 : print ( "Age is definetly not eligible for driving" ) else : print ( "Yes. You can drive." )

Python Tutorial 8 --- "If Else & Elif Conditionals In Python"

 Python Tutorial 8 ---  "If Else & Elif Conditionals In Python" This PROGRAM or TUTORIAL about Python's  "If Else & Elif Conditionals In Python" DOC “If, else and elif statement can be defined as a multiway decision taken by our program due to the certain conditions in our code.” For few readers, the term “elif” is new as they are not familiar with the word and it is also not like most of the other words such as list or loops, etc. that have the same meaning in the English language and in Python programming. In fact, in English “elif” means honest. But if you have ever done programming in any language, you must be familiar with “else-if” statement, well “elif” is just that. Now coming towards a more formal sort of description. “If and else” are known as decision-making statements for our program. They are very similar to the decision making we apply in our everyday life that depends on certain conditions. The everyday example is thoroughly explained ...