/AdvancePythonLab

AdvancePythonLab

Primary LanguageJupyter Notebook

AdvancePythonLab

PART-A

  1. Write a python program to check whether the number is prime or not.

  2. Write a Python program to calculate the length of a string without using built in function and check whether it is a palindrome or not.

  3. Write a Python function that accepts a sentence from the user and counts the number of words in the sentence.

  4. Write a Python program to sum all the numbers in a list.

  5. Write a Python program to store phone numbers of persons in a dictionary and display the phone number of the requested person.

  6. Develop a python program to copy the contents of only odd lines from one file to another file.

  7. Write a python program to check if the number is even or odd using a user defined function.

  8. Develop a python program to count occurrence of all characters present in a string.

NOTE: The above programs will be assessed in CIE ONLY.

PART-B A- Demonstration A1. Create a base class “polygon” and the derived class “triangle”, demonstrate inheritance by inheriting findArea() function to calculate area of the triangle.

A2. Design a Python program using Regular expressions to a) Extract Email IDs from a given text. b) Validate the user password with minimum length=6 and maximum length=16 and must have at least one lower-case letter, upper-case letter, number and special symbol (#, @, $, _).

A3. Write a NumPy program to create a structured array from given student name, height, class and their data types. Finally sort the array on height.

A4. Read the given data “churn.csv” and save it as a dataframe called churn_data. Perform following operations on the dataframe i) Count total number of duplicate records in the dataframe ii) Count the no. of duplicate records in the churn dataframe based on the cutomerID column iii) Count number of missing values in each columns iv) Count the total no. of missing values for the variable TotalCharges v) Average monthly charge paid by a customer for the services he/she has signed up for vi) Display the records having “1@#” under the variable Dependents vii) Replace null values in churn dataframe by median value or by max count class category (https://drive.google.com/file/d/1JSYGIIkIZr4jyheDEH0X1_TMSnQ2CzXc/view)

B- Exercise B1. Explore the bicycle counts on Seattle’s Fremont Bridge Data with respect to i) Average daily bicycle counts ii) Average hourly bicycle counts by weekday and weekend.
(https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=DOWNLOAD)

B2. Using the data on births in the United States, provided by the Centers for Disease Control (CDC), Find i) Total number of US births by year and gender ii) Average daily births by day of week and decade (https://raw.githubusercontent.com/jakevdp/data-CDCbirths/ master/births.csv)

C- Structured Inquiry C1. Develop a python program to store and display Employee details such as EID, Name, Place, and Department. The EID must be auto-generated for each employee.

C2. Explore the automobile dataset and visualize the i) Distribution of the two and four door cars with respect to the type of fuel they use ii) Distribution of cars of different body styles with respect to the type of fuel they use ii) Total number of each type of body style cars categorized by fuel type iii) Horsepower of each of the fuel type with reference to the type of drive wheel present in cars. (https://www.kaggle.com/datasets/toramky/automobile-dataset?resource=download)