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

python-clean-coding-assignment

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

python-clean-coding-assignment

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

Assignment –2024

School Name: School Of Information And Technology


Program BCA Semester 1st
Subject Code 24BCAI11E01 Subject Name Python and clean
coding
Max Marks 15 Submit by 29/11/2024

Assignment 1: Fundamentals of Python


5 marks

Question:
Write a Python program that performs the following tasks:

1. Ask the user to input a string.

2. Reverse the string and print the result.

3. Use a for loop to print each character of the reversed string on a


new line.

4. If the string contains the word "Python", print "Python is found!";


otherwise, print "Python is not found!"

Assignment 2: Numpy Basics 5


marks

Question:
Create a Python script using Numpy to do the following:

1. Create a 3x3 matrix filled with random integers between 1 and 50.

2. Find and print the maximum value of the matrix along each row and
column.

3. Flatten the matrix into a one-dimensional array and print the result.

4. Reshape the flattened array back into a 3x3 matrix and print it.

5. Calculate the sum of all elements in the matrix and print the result.

Assignment 3: Pandas DataFrame Operations


5 marks

Question:
1. Create a Pandas DataFrame with the following data:

Ag Salar Departme
Name
e y nt

5000
John 25 HR
0

6000
Alice 30 IT
0

5500
Bob 35 Finance
0

Catherin 6500
28 IT
e 0

7000
David 40 HR
0

2. Perform the following operations:

o Filter and display only the rows where the department is "IT".

o Add a new column, "Bonus," where the bonus is 10% of the


salary.

o Sort the DataFrame by the "Age" column in descending order.

o Calculate the average salary of employees in the "HR"


department.

3. Save the resulting DataFrame into a CSV file named


employee_data.csv.

-----------------------------------------------------------------------------------------------
--

You might also like