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

Function Question

1. A function that generates a series of equidistant numbers between a first and last value passed to the function. 2. A function that takes two numbers and returns the number with the minimum ones digit. 3. A function that takes two char arguments and returns True if they are equal, False otherwise.

Uploaded by

tarannumjamal19
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Function Question

1. A function that generates a series of equidistant numbers between a first and last value passed to the function. 2. A function that takes two numbers and returns the number with the minimum ones digit. 3. A function that takes two char arguments and returns True if they are equal, False otherwise.

Uploaded by

tarannumjamal19
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

FUNCTIONS

Q1. Write a program that generates a series using a function which takes first and
last values of the series and then generates four terms that are equidistant e.g., if
two numbers passed are 1 and 7 then function returns 1 3 5 7.

Q2. Write a function that takes two numbers and returns the number that has
minimum one's digit. [For example, if numbers passed are 491 and 278, then the
function will return 491 because it has got minimum one's digit out of two given
numbers (491's 1 is < 278's 8)].

Q3. A function that takes two char argument and returns True if both the
arguments are equal otherwise False.

Q4. Write a program that reads a date as an integer in the format MMDDYYYY.
The program will call a function that prints print out the date in the format , .
Sample run :

Enter date: 12252019


December 25, 2019

Q5. Write a function called remove First that accepts a list as a parameter. It
should remove the value at index 0 from the list.

Q6. Write the definition of a function Reverse(X) in Python, to display the


elements in reverse order such that each displayed element is the twice of the
original element (element * 2) of the List X in the following manner:
Example: If List X contains 7 integers is as
follows: [4 8 7 5 6 2 10 ]
After executing the function, the array content should be displayed as
follows:
20 4 12 10 14 16 8

Q7. Write a user-defined function String_reverse() that accepts a string as an


argument and returns after reversing a string. Sample String: “Pythonxyz”
Expected Output: “zyxnohtyP”
Q8. Write a function AddZero(Scores) to add all those values in the list of Scores
which are ending with zero, and display the sum. For example,
If the Scores contain[200,456,300,500,233,453] The sum of scores should be
displayed as 1000.

Q9. Write a function LShift(Arr,n) in Python, which accepts a list Arr of numbers
and n is a numeric value by which all elements of the list are shifted to left.
Sample Input Data of the list Arr= [ 10,20,30,40,12,11], n=2
Output Arr = [30,40,12,11,10,20

Q10. Write a program that generates a series using a function which takes first
and last values of the series and then generates four terms that are equidistant

e.g., if two numbers passed are 1 and 7 then function returns 1 3 5 7.[hint:- find
common difference use A.P. formula, number of term is 4]

You might also like