Pert Q Python
Pert Q Python
Data Manipulation:
4. Given a list of numbers, write a Python function to find the sum of all even numbers in the list.
5. Write a program that reads a CSV file containing student data (name, age, grade) and prints the
name of the student with the highest grade.
String Manipulation:
8. Given a list of numbers, find the maximum and minimum values without using built-in functions
like max() and min().
9. Create a dictionary with student names as keys and their corresponding grades as values. Write a
function to find the average grade.
12. Write a Python module that contains a function to calculate the area of a circle, and then use that
module in a separate script to calculate the area of a circle with a given radius.
13. Create a Python function that takes a list of numbers and returns a new list with only the even
numbers.
List Comprehensions:
16. Write a Python list comprehension to create a list of squares for numbers from 1 to 10.
17. Use list comprehension to filter out even numbers from a given list of integers.
These practical Python questions cover a variety of topics and can be used to assess
your coding skills and problem-solving abilities. You can adapt them to your specific
needs and add more questions as desired.
NumPy:
1. Given a NumPy array arr, write code to find the mean, median, and standard deviation of
the data.
2. Create a NumPy array with random integer values, and then filter the values to only
include those that are greater than a certain threshold.
3. Write code to perform element-wise addition and multiplication between two NumPy
arrays.
4. Load a dataset into a NumPy array and compute the correlation matrix for the numerical
variables in the dataset.
Pandas:
5. Load a CSV file into a Pandas DataFrame and display the first 5 rows of the DataFrame.
6. Given a DataFrame with columns for "Name," "Age," and "Gender," write code to filter
out individuals older than 30 years.
7. Calculate the sum of a specific column in a Pandas DataFrame and display the result.
8. Merge two DataFrames based on a common column, such as an ID or key, and create a
new merged DataFrame.
9. Remove duplicate rows from a Pandas DataFrame, and display the DataFrame after
duplicates have been removed.
10. Handle missing values in a Pandas DataFrame by either filling them with a specific value
or dropping rows with missing values.
11. Load a dataset and use Pandas to calculate the mean, median, and standard deviation for a
specific numerical variable.
12. Create a bar plot to visualize the distribution of a categorical variable in a Pandas
DataFrame.
13. Create a new column in a Pandas DataFrame that calculates the BMI (Body Mass Index)
based on "Height" and "Weight" columns.
14. Normalize a numerical variable in a Pandas DataFrame to have a mean of 0 and a
standard deviation of 1.
15. Filter a Pandas DataFrame to include only rows where a specific condition is met, such as
"Sales" > 1000.
16. Select specific columns from a Pandas DataFrame and create a new DataFrame with only
those columns.