Challenge: Classify Numbers
Task
Swipe to start coding
Write a function that takes a single numeric input and returns a string indicating whether the number is "Positive", "Negative", or "Zero". Use if, else if, and else statements to determine the correct label.
- If the input is greater than zero, return "Positive".
- If the input is less than zero, return "Negative".
- If the input is equal to zero, return "Zero".
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 2
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Awesome!
Completion rate improved to 5.56
Challenge: Classify Numbers
Swipe to show menu
Task
Swipe to start coding
Write a function that takes a single numeric input and returns a string indicating whether the number is "Positive", "Negative", or "Zero". Use if, else if, and else statements to determine the correct label.
- If the input is greater than zero, return "Positive".
- If the input is less than zero, return "Negative".
- If the input is equal to zero, return "Zero".
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 1. ChapterΒ 2
single