Question: Explanation: Functions can make different decisions based on the given data. The if statement allows such functionality to be implemented. The main part of the

Explanation:
Functions can make different decisions based on the given data. The if statement allows such functionality to be implemented. The main part of the if statement is a condition: if the condition is fulfilled, then any statements after the keyword if are executed; otherwise, statements after the keyword else are executed instead.
Here is the code of a function, absolute_value, that takes one parameter named number and prints its absolute value (for negative numbers we just skip the minus).
def absolute_value (number) :
if number 0:
print (-1* number)
else:
print (number)
Question:
Complete the provided function solution so that it prints larger of the two given parameters, number1 and number2. You should just replace the question marks in the code with the correct parameters.
def solution (number1, number2) :
if ?<?:
print (number1)
else:
print (number2)
Examples:
1. Given number1=3 and number2=7, the function should
print 7.
2. Given number1=1 and number2=0, the function should
print 1.
3. Given number1=4 and number2=4, the function should
print 4.
Autocomplete is connecting...

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!