How do I put an if and else loop in Python?

Python: Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.

It is used for:

  • web development (server-side),
  • software development,
  • mathematics,
  • system scripting

if condition: We are using if condition for checking the given condition is true or not,

elif: The elif keyword says the previous condition was not true.

else: The else condition is running only when the if condition false.


Program:

  1. 1. a = 20 

  2. 2. b = 10 

  3. 3. if b > a: 

  4. 4. print("b is greater than a") 

  5. 5. elif a == b: 

  6. 6. print("a is equal to b") 

  7. 7. else: 

  8. 8. print("a is greater than b") 

Comments

Popular posts from this blog

proassignment help backlink data index 41

Programming shark backlink data index 67

programming shark backink data index 31