Advertisement
SimeonTs

SUPyF2 Basic - 02. Number Definer

Sep 19th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 KB | None | 0 0
  1. """
  2. Basic Syntax, Conditional Statements and Loops - Lab
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1718#1
  4. Video: https://www.youtube.com/watch?v=sP_t7cbZF7c
  5.  
  6. SUPyF2 Basic - 02. Number Definer
  7.  
  8. Problem:
  9. Write a program that reads a floating-point number and prints "zero" if the number is zero.
  10. Otherwise, print "positive" or "negative". Add "small" if the absolute value of the number is less than 1,
  11. or "large" if it exceeds 1 000 000.
  12. Example:
  13.  
  14. Input:              |Output:
  15. ------------------------------------
  16. 25                  |positive
  17. 0.7                 |small positive
  18. 435247392.921       |large positive
  19. -0.005              |small negative
  20. -103.21             |negative
  21. -358583355123.001   |large negative
  22. """
  23. num = float(input())
  24.  
  25. if num == 0:
  26.     print("zero")
  27. elif num > 0:
  28.     if num < 1:
  29.         print("small positive")
  30.     elif num > 1000000:
  31.         print("large positive")
  32.     else:
  33.         print("positive")
  34. elif num < 0:
  35.     if abs(num) < 1:
  36.         print("small negative")
  37.     elif abs(num) > 1000000:
  38.         print("large negative")
  39.     else:
  40.         print("negative")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement