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

Pert Q Python

Uploaded by

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

Pert Q Python

Uploaded by

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

Basic Python:

1. Write a Python function to calculate the factorial of a given integer.


2. Create a program that checks whether a given number is prime or not.
3. Write a Python script that reads a text file and counts the number of words in it.

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:

6. Write a Python function to reverse a given string.


7. Create a script that takes a sentence as input and returns the sentence with each word capitalized.

Lists and Dictionaries:

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.

Functions and Modules:

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.

data visulization praticle quations in python


1. Basic Line Plot (Matplotlib):
 Given a list of x and y values, create a line plot using Matplotlib. Label the axes and give
the plot a title.
2. Bar Chart (Matplotlib):
 Using a dictionary of data, create a bar chart that displays the values for different
categories. Add labels to the bars and axes.
3. Scatter Plot (Matplotlib):
 Generate random data for x and y coordinates and create a scatter plot using Matplotlib.
Customize the marker style and colors.
4. Histogram (Matplotlib):
 Load a dataset and create a histogram to visualize the distribution of a specific feature. Set
the number of bins and add labels.
5. Box Plot (Seaborn):
 Use Seaborn to create a box plot to show the distribution of a numerical variable. Include
labels for the plot and axes.
6. Violin Plot (Seaborn):
 Create a violin plot using Seaborn to compare the distribution of a numerical variable
across different categories. Customize the plot appearance.
7. Heatmap (Seaborn):
 Load a dataset and create a heatmap to visualize the correlation between variables.
Adjust the color map and labels.
8. Time Series Plot (Matplotlib):
 Use time-series data to create a line plot, displaying a trend over time. Customize the x-
axis with date labels.
9. Bar Chart with Error Bars (Matplotlib):
 Create a bar chart with error bars to show the mean and uncertainty in data. Use
Matplotlib to represent this information.
10. Stacked Area Plot (Matplotlib):
 Given multiple datasets, generate a stacked area plot to display the contributions of
different categories over time.
11. Interactive Plot (Plotly):
 Use Plotly to create an interactive line plot that allows zooming, panning, and hover
information for data points.
12. Geospatial Data (Folium):
 Load geospatial data and create a map with Folium to display data points on a map.
Customize the markers and tooltips.
13. 3D Plot (Matplotlib):
 Generate 3D data and create a 3D scatter plot or surface plot using Matplotlib to visualize
a three-dimensional dataset.
14. Subplots (Matplotlib):
 Create a figure with multiple subplots, each displaying a different aspect of the data.
Customize the appearance of each subplot.
15. Animated Plot (Matplotlib or Plotly):
 Animate a plot to show changes in data over time. This could be a line plot, bar chart, or
other suitable visualization.

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.

Data Cleaning with Pandas:

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.

Data Analysis with Pandas:

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.

Data Transformation with Pandas:

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.

Data Filtering and Selection with Pandas:

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.

You might also like