0% found this document useful (0 votes)
13 views

Function Call

The document outlines a series of programming tasks focused on creating and calling various types of functions in Python. It includes examples of functions with no parameters, functions with parameters, functions that return values, and functions that incorporate conditional logic. Each task specifies what the function should do and provides examples of how to call the functions with specific arguments.

Uploaded by

rubikakesavan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Function Call

The document outlines a series of programming tasks focused on creating and calling various types of functions in Python. It includes examples of functions with no parameters, functions with parameters, functions that return values, and functions that incorporate conditional logic. Each task specifies what the function should do and provides examples of how to call the functions with specific arguments.

Uploaded by

rubikakesavan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Function Call
📌 Write a function greet() that prints "Hello, welcome!" when called. Then, call the
function.

2. Function with Parameters

📌 Write a function multiply(a, b) that takes two numbers as parameters and prints
their product. Call the function with values 4 and 5.

3. Function with Return Value

📌 Write a function divide(x, y) that takes two numbers as input, divides them, and
returns the result. Call the function with 10 and 2, store the result in a variable, and
print it.

4. Function with Conditional Logic

📌 Write a function is_even(num) that checks if a number is even. If even, return


"Even", otherwise return "Odd". Call it with 7 and print the result.

5. Function with No Parameters

📌 Write a function show_message() that prints "Python is fun!" and call the function.

6. Function with Multiple Parameters

📌 Write a function subtract(a, b) that takes two numbers and returns their difference.
Call the function with 15 and 7, store the result, and print it.

7. Function Returning Multiple Values

📌 Write a function calculate(a, b) that returns both the sum and product of two
numbers. Call the function with 3 and 4, then print both results.

8. Function with Conditional Logic

📌 Write a function is_positive(n) that returns "Positive" if the number is greater than 0,
"Negative" if less than 0, and "Zero" otherwise. Call with -5 and print the result.
9. Function Combining Everything
📌 Write a function check_grade(marks) that:
Takes marks as input.
Returns "Pass" if marks >= 50, else returns "Fail".
If marks are 90 or above, also print "Excellent!".
Call the function with 95 and print the result.

10.Function with Default Parameter

📌 Write a function greet(name="Guest") that prints "Hello, [name]!". If no name is


provided, it should print "Hello, Guest!". Call it twice: once with "Alice" and once
without any argument.

You might also like