Largest of Two
Beginner
Largest of Two
Hey young coder! Let's play a fun game with numbers. Your task is to write a function called largest_of_two.
The goal of this function is simple: we give it two numbers, and your function should return the largest one.
Imagine a world where two numbers compete to see which one is the biggest! Which one will win? Your code will decide!
Here's how you can think about it:
- You have two numbers, let's call them
aandb. - Your job is to check which one is larger and return it.
Examples
Let's see some examples:
largest_of_two(10, 20) # This should return 20, because 20 is larger than 10
largest_of_two(100, 30) # This should return 100, because 100 is larger than 30
largest_of_two(5, 5) # This should return 5, because both numbers are equal, so 5 is also the largest
Have fun writing the code that finds the biggest champion between two numbers!
Inputs
Arg 1:
10Arg 2:
20Expected Output
20Actual Output