Alx09

Ex2 bun

Apr 1st, 2022 (edited)
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. import math
  2. valPerferSqare = []
  3. def isSqare(value):
  4.     root = math.sqrt(value);
  5.     if int(root + 0.5) ** 2 == value:
  6.         print(value, "is a perfect square")
  7.         valPerferSqare.append(value)
  8.     else:
  9.         print(value, "is not a perfect square")
  10. valIntrod = []
  11. for i in range(5):
  12.     value  = int(input("Enter the Number "))
  13.     isSqare(value)
  14.     valIntrod.append(value)
  15. valPerferSqare.sort(reverse=True)
  16. valIntrod.sort(reverse=True)
  17. print("Lista valori intoduse " )
  18. print(valIntrod)
  19. print("Lista patrate perfecte " )
  20. print( valPerferSqare)
  21.  
Add Comment
Please, Sign In to add comment