explain the use of if..... and else.... statement in python . Also write the syntax
Answers
Python : is a general purpose and high level programming language. You can use Python for developing desktop GUI applications, websites and web applications. Also, Python, as a high level programming language, allows you to focus on core functionality of the application by taking care of common programming tasks.
Syntax : The purpose of syntax is to study sentence structure and formation. It involves setting rules for creating coherent and grammatically correct sentences by focusing on word order, phrases, clauses, and the relationships among them. Our effective spoken and written communication both depend on the proper use of syntactic rules. However, when we speak, we follow syntax rules more loosely, though we are still able to convey our message
Hope it helps you...
Decision making is required when we want to execute a code only if a certain condition is satisfied.
The if...else statement is used in Python for decision making.
Syntax of if...else
if test expression:
Body of if
else:
Body of else
The if..else statement evaluates test expression and will execute the body of if only when the test condition is True. If the condition is False, the body of else is executed.