Advertisement
informaticage

Intro python

Jun 7th, 2021
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. print("Hello World")
  2. ingresso = input("Dammi qualcosa in ingresso: ")
  3.  
  4. print("Hai inserito:", ingresso)
  5. def identity(num):
  6.   return num
  7.  
  8. def absolute_value(num):
  9.   if(num >= 0):
  10.     return num
  11.   return -num
  12.  
  13. # Operators
  14. 4 + 5
  15. 5 - 2
  16. 5 * 2
  17. 5 ** 2
  18. 5 / 2
  19. 5 // 2
  20.  
  21. result = 4 ** 3
  22. print("ciao", result, "tonno")
  23.  
  24. age = 25
  25. height = 140
  26. # > < >= <= == !=
  27. # not(a and b) === not a or not b
  28. # not(a or b) === not a and not b
  29. if(not(not(age >= 18) and not(height > 160))):
  30.   print("Puoi salire sulla giostra - dell' if")
  31. else:
  32.   print("Sorry non puoi salire")
  33.  
  34. while(not(not(age >= 18) and not(height > 160))):
  35.   print("Puoi salire sulla giostra")
  36.   age = age - 1
  37.   print("Altra cosa")
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement