Python BasicsEasy

Positive or Negative number

Detailed guide and Python implementation for the 'Positive or Negative number' problem.

Problem Statement

Easy

Write a function check_sign(n) that takes an integer n and returns the string "Positive" if n is greater than zero, "Negative" if n is less than zero, or "Zero" if n is exactly zero.

Constraints
  • -10^9 <= n <= 10^9

Examples

Example 1
Input
n = 5
Output
"Positive"
Explanation

5 is greater than 0, so we return "Positive".

Example 2
Input
n = -3
Output
"Negative"
Explanation

-3 is less than 0, so we return "Negative".

Example 3
Input
n = 0
Output
"Zero"
Explanation

0 is neither positive nor negative, so we return "Zero".

Need a Hint?
Consider using Basics-specific data structures like sets or heaps.
Edge Cases to Watch
  • Empty input structures
  • Single element inputs
  • Large numerical bounds

Ready to Solve?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

Open in Editor

Recommended Python Resources

Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.