Challenge: Parameter Practice
Oppgave
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
num1tonum2. - If
num1is greater thannum2, return a string in the format "num1 is greater than num2". - If
num1is less thannum2, return a string in the format "num1 is less than num2". - If
num1is equal tonum2, return a string in the format "num1 is equal to num2".
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 4
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Suggested prompts:
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Fantastisk!
Completion rate forbedret til 5.56
Challenge: Parameter Practice
Sveip for å vise menyen
Oppgave
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
num1tonum2. - If
num1is greater thannum2, return a string in the format "num1 is greater than num2". - If
num1is less thannum2, return a string in the format "num1 is less than num2". - If
num1is equal tonum2, return a string in the format "num1 is equal to num2".
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 4
single