Advertisement
makispaiktis

Python2 - Numbers and Functions

Apr 6th, 2019 (edited)
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. from math import *
  2.  
  3. number = 38;
  4. print(str(number) + " is my favourite number");     # Μετατρέπω integer σε string μέσω της συνάρτησης str()
  5. number = -number;
  6. print(abs(number));                                 # Απόλυτη τιμή
  7. print(pow(4, 6));
  8. print("Max of " + str(number) + " and 50 is: " + str( (max(number, 50)) ));
  9. newNumber = min(number, -40);
  10. print(abs(newNumber));
  11. num = round(3.8);
  12. num2 = round(3.2);
  13. print(num);                                         # Στρογγυλοποίηση
  14. print(num2);                                        # Στρογγυλοποίηση
  15. print(round(-4.1))                                  # Στρογγυλοποίηση
  16. print("\n")
  17.  
  18. # Math Functions from import
  19. print("Other math functions");
  20. print(floor(8.8));
  21. print(ceil(8.8));
  22. print(sqrt(36));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement