0% found this document useful (0 votes)
12 views2 pages

Assignment 2 - Function and Class

Uploaded by

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

Assignment 2 - Function and Class

Uploaded by

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

t

aa
Module 2: Function and Class
Assignment
lliP
te
In

Contact us: [email protected] / © Copyright Intellipaat / All rights reserved


Python for Data Science Certification Course

Problem Statement:
You work in XYZ Corporation as a Data Analyst. Your corporation has told you to
work on functions and classes.

Tasks To Be Performed:
1. Create a function named ‘factor’ that can only accept 1 argument. The
function should return the factorial of that number.
2. Create a function named ‘check_string’, the function should accept a string
data from the user and the function should check if the user input contains

t
the letter ‘s’ in it. If it contains the letter ‘s’ then print- ‘The string is

aa
containing the letter ‘s’’, if not then print- ‘The string doesn’t contain the
letter ‘s’’.
3. Create a class named ‘student’ and inside the class, create a function
named ‘fun1’- this method should accept the user defined input and return
that value:
lliP
a. Create another method named- message() and that method should print
the user defined input that we have defined in ‘fun1’.

4. Create a lambda function that should double or multiply the number (that
we will be passing in the lambda function) by 2. Store the lambda function
in a variable named ‘double_num’.
5. Take user input string and check whether that string is palindrome or not.
te
In

Contact us: [email protected] / © Copyright Intellipaat / All rights reserved

You might also like