• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# SUPyF2 Basic - 02. Number Definer

SimeonTs Sep 19th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. """
2. Basic Syntax, Conditional Statements and Loops - Lab
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")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top