0% found this document useful (0 votes)
10 views2 pages

Python Data Analytics Practice Questions

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)
10 views2 pages

Python Data Analytics Practice Questions

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

PYTHON & DATA ANALYTICS PRACTICE QUESTIONS

1. What is the difference between a list and a tuple in Python?


2. What is indexing in Python?
3. What is slicing in Python? Write one example.
4. What is negative indexing?
5. Write the output of:
6. x = [10, 20, 30, 40]
7. print(x[-1])

8. What is a function in Python?


9. Why do we use functions in Python?
10. What is the difference between print() and return?
11. What is a loop in Python?
12. Write a for loop to print numbers from 1 to 5.
13. Write a Python program to check whether a number is even or odd.
14. Write a loop to print numbers from 10 to 1.
15. What is NumPy?
16. Write any two features of NumPy arrays.
17. Convert the list [5, 10, 15, 20] into a NumPy array.
18. Write code to find the mean of a NumPy array.
19. What is Pandas used for?
20. What is a DataFrame in Pandas?
21. What does [Link]() do?
22. What does [Link] return?
23. Create a Pandas DataFrame with columns Name and Marks.
24. Write code to add 5 marks to all students in a DataFrame.
25. Write a Pandas command to display rows where Marks > 60.
26. Write code to sort a DataFrame by Marks in descending order.
27. What is Matplotlib?
28. What is the use of [Link]()?
29. Write code to create a simple line plot using Matplotlib.
30. What are xlabel and ylabel used for?
31. Identify the error in the following code:

def add(a,b):
c = a + b
print(c)

30. Identify the error in the following code:

nums = [1,2,3]
print(nums[3])

31. Identify the error in the following code:

for i in range(5)
print(i)

32. Identify the error in the following Pandas code:

df = [Link](data)

33. Identify the error in the following code:

x = 10
y = "5"
print(x + y)

34. Identify the logic error in the following code:

nums = [2,4,6,8]
for i in nums:
print(nums[i])

35. Write a function to count how many numbers between 1 and 20 are divisible by 2.
36. Write a Python program to calculate the sum of numbers from 1 to 50.
37. Create a DataFrame and calculate the average of a numeric column.
38. Write code to filter even numbers from a list.
39. Write code to find the maximum value from a NumPy array.
40. Write a Python program to create and display a basic line chart.

You might also like