Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Parameter Practice | Writing Functions in R
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Functions and Functional Programming in R

bookChallenge: Parameter Practice

Opgave

Swipe to start coding

Write a function compare_numbers that takes two numbers as input and returns a string stating whether the first is greater than, less than, or equal to the second.

  • Compare the value of num1 to num2.
  • If num1 is greater than num2, return a string in the format "num1 is greater than num2".
  • If num1 is less than num2, return a string in the format "num1 is less than num2".
  • If num1 is equal to num2, return a string in the format "num1 is equal to num2".

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 4
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Parameter Practice

Stryg for at vise menuen

Opgave

Swipe to start coding

Write a function compare_numbers that takes two numbers as input and returns a string stating whether the first is greater than, less than, or equal to the second.

  • Compare the value of num1 to num2.
  • If num1 is greater than num2, return a string in the format "num1 is greater than num2".
  • If num1 is less than num2, return a string in the format "num1 is less than num2".
  • If num1 is equal to num2, return a string in the format "num1 is equal to num2".

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 4
single

single

some-alt