Question 1 Functions Geometry

Function to Calculate the Area of a Circle

Write a Python function `area_of_circle(radius)` that takes radius as an argument and returns the area of the circle.

Solution Code Screenshot Click image to zoom
Function Area of Circle Solution
Question 2 Functions Basics

Function to Add Two Numbers

Write a Python function `add_numbers(a, b)` that takes two parameters, adds them together, and returns the result.

Solution Code Screenshot Click image to zoom
Function Add Two Numbers Solution
Question 3 Functions Buzz Number

Function to Check if a Number is a Buzz Number

Write a Python function `is_buzz_number(n)` that returns True if a number is divisible by 7 or ends in 7, and False otherwise.

Solution Code Screenshot Click image to zoom
Function Buzz Number Solution
Question 4 Functions Prime Check

Function to Check for Prime Number

Write a Python function `is_prime(n)` that tests whether an integer is prime and returns a boolean value.

Solution Code Screenshot Click image to zoom
Function Is Prime Solution
Question 5 Functions Palindromic Prime

Function to Check Palindromic Prime Number

Write a Python function to check whether an integer is a Palindromic Prime (a number that is both a prime and reads the same backwards, e.g., 131).

Solution Code Screenshot Click image to zoom
Function Palindromic Prime Solution
Question 6 Functions List Processing

Function to Extract and Print Even Numbers from a List

Write a Python function `print_even_numbers(lst)` that accepts a list of integers and prints all even elements.

Solution Code Screenshot Click image to zoom
Function Print Even from List Solution
Question 7 Functions Twin Primes

Function to Identify and Print Twin Prime Pairs

Write a Python function to find and display all Twin Prime pairs (pairs of primes having a difference of 2, like 3 & 5, 11 & 13) within a given range.

Solution Code Screenshot Click image to zoom
Function Twin Prime Solution
Question 8 Functions Even/Odd Sum

Function to Sum Even and Odd Numbers Separately

Write a Python function that takes a sequence of integers and returns two distinct values: the sum of even numbers and the sum of odd numbers.

Solution Code Screenshot Click image to zoom
Function Sum Even Odd Separate Solution
Question 9 Functions Math Module

Demonstration of Built-in Math Module Functions

Write a Python program utilizing standard mathematical functions from the `math` module (such as sqrt, pow, ceil, floor, and fabs).

Solution Code Screenshot Click image to zoom
Function Math Module Solution
Question 10 Functions Palindrome

Function to Check Palindrome Number

Write a Python function `is_palindrome(num)` to test whether an integer reads the same forwards and backwards.

Solution Code Screenshot Click image to zoom
Function Palindrome Number Solution
Question 11 Functions Fundamentals

Introduction to Defining and Calling Functions

Write a foundational Python script demonstrating function definition syntax (`def`), parameters, return statements, and calling conventions.

Solution Code Screenshot Click image to zoom
Function Fundamentals Solution
Question copied to clipboard!