Assignment Questionss m3, m4, m5
Assignment Questionss m3, m4, m5
Assignment Questions
Sub:Python Application Programming SubCode:22CS44
Module-3
1a. write programs to do the following tasks.
Strong Password Detection
Write a function that uses regular expressions to make sure the password string it is
passed is strong. A strong password is defined as one that is at least eight characters
long, contains both uppercase and lowercase characters, and has at least one digit.
You may need to test the string against multiple regex patterns to validate its strength
1b. with suitable python code explain i) Reading ZIP files ii)Extracting from ZIP files
iii) creating and Adding to ZIP files
2a. Create a Mad Libs program that reads in text files and lets the user add their own
text anywhere the word ADJECTIVE, NOUN, ADVERB, or VERB appears in the text
file. For example, a text file may look like this: The ADJECTIVE panda walked to the
NOUN and then VERB. A nearby NOUN was unaffected by these events.
The program would find these occurrences and prompt the user to replace them.
Enter an adjective:
silly
Enter a noun:
chandelier
Enter a verb:
screamed
Enter a noun:
pickup truck
Module-4
1a. write a python program to illustrate type-based dispatch
1b. write a python program to illustrate __init__( ) and __str__( ) also discuuss their
roles in your program.
2a. write a program to create a class Time to represent time in HH:MM:SS format.
Perform the following operations:
a. Overload + to add two time objects
b. Overload + to add a numeric value to a time object
c. Overload __str__ ( ) to display time in appropriate format.
2b.Differentiate pure functions and modifiers with suitable codes.
Module-5
1a. Create the following NumPy arrays:
a) A 1-D array called zeros having 10 elements and all the elements are set to zero.
b) A 1-D array called vowels having the elements ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’.
c) A 2-D array called ones having 2 rows and 5 columns and all the elements are set
to 1 and dtype as int.
d) Use nested Python lists to create a 2-D array called myarray1 having 3 rows and 3
columns and store the following data:
2.7, -2, -19
0, 3.4, 99.9
10.6, 0, 13
e) A 2-D array called myarray2 using arange() having 3 rows and 5 columns with start
value = 4, step size 4 and dtype as float.
1b.Make use of NumPy library write a python code to illustrate operations on arrays.
2a. Demonstrate with suitable examples different ways in which a series can be
created in Pandas.
2b.list Attributes and methods of Pandas Series