Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Classify Numbers | R Conditional Statements Tutorial
Control Flow in R

bookChallenge: Classify Numbers

Aufgabe

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".

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 2
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Suggested prompts:

Can you explain this in simpler terms?

What are the main points I should remember?

Can you give me an example?

close

bookChallenge: Classify Numbers

Swipe um das Menü anzuzeigen

Aufgabe

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".

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 2
single

single

some-alt