Advertisement
Carl123432

PythonTwitterLeassonEP4

Jan 18th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. # More on if, elif and else statments.
  2.  
  3. # I belive most you of you will understand what they basicly do.
  4. # An if statment will look and see if the if statment matches another value or condtion.
  5. # elif statment is when you have more then one if statment like in the pervious leasson.
  6. # else statment in the last statment you write in your code of if statments so like this
  7.  
  8. i = 5
  9.  
  10. if i >= 15:
  11.     print('i is above 15')
  12. elif i < 10:
  13.     print('i is bellow 10')
  14. else:
  15.     print('Blank text')
  16.  
  17. # Condtion that can be used in statments.
  18.  
  19. # ==, Equal too
  20. # >, More than
  21. # <, Less than
  22. # >=, More than, equal too
  23. # <=, Less than, equal too
  24. # Try writing your own code, ask the user names and age, and then tell the user if they are over 18 by using a if statment.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement