Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Practical Question of Python

The document outlines a comprehensive curriculum for programming in Python, divided into eight units covering various topics such as basic programming, control statements, built-in data types, functions, object-oriented programming, file handling, common libraries, and advanced topics. Each unit includes specific programming tasks and challenges aimed at enhancing the learner's skills in Python. The curriculum emphasizes practical applications and problem-solving through programming exercises.

Uploaded by

pravesh koirala
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Practical Question of Python

The document outlines a comprehensive curriculum for programming in Python, divided into eight units covering various topics such as basic programming, control statements, built-in data types, functions, object-oriented programming, file handling, common libraries, and advanced topics. Each unit includes specific programming tasks and challenges aimed at enhancing the learner's skills in Python. The curriculum emphasizes practical applications and problem-solving through programming exercises.

Uploaded by

pravesh koirala
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Unit 1: Introduction

1. Write a program that asks the user to input a number and checks if it's even or odd.
2. Create a program that accepts two numbers and swaps their values using only variable
assignments.
3. Write a program to calculate the area and circumference of a circle given its radius.

Unit 2: Control Statements

4. Write a program to check whether a character is a vowel or consonant.


5. Implement a program that uses the match-case statement to map weekdays to their
respective numbers (1-7).
6. Write a program that checks if a number is prime or not.
7. Create a program to find the factorial of a number.
8. Implement a program that counts the number of vowels and consonants in a user-given
string.
9. Write a program that sums all numbers between 1 and a given number.

Unit 3: Built-In Data Types

10. Create a list of numbers and display the second highest number.
11. Write a program to find the sum and average of elements in a list.
12. Write a program to reverse a string without using built-in reverse functions.
13. Create a dictionary where keys are countries and values are their capitals. Display all
country-capital pairs.
14. Write a program to find the largest number in a tuple.
15. Create a set from a list and perform set operations like symmetric difference and union.

Unit 4: Functions

16. Write a function that returns the maximum and minimum numbers in a list.
17. Implement a function to calculate the number of vowels in a given string.
18. Write a program to create a function that takes a list of numbers and returns a new list
with each element squared.
19. Implement a recursive function to calculate the sum of all numbers up to a given number.
20. Write a program using lambda functions to filter out all the numbers greater than 10 from
a list.

Unit 5: Object-Oriented Programming

21. Create a class Book with attributes for title, author, and price, and a method to display
book details.
22. Create a class Circle with methods to calculate the area and circumference. Demonstrate
method overloading by adding a method for the diameter.
23. Create an abstract class Shape with an abstract method area(). Implement this in
subclasses Rectangle and Triangle.
24. Write a program with custom exceptions for a BankAccount class to handle cases of
invalid withdrawals (e.g., insufficient funds).
25. Write a program to demonstrate multilevel inheritene.

Unit 6: File Handling

26. Write a program to read from one text file and copy its content into another file.
27. Create a program that writes user information (name, age, address) to a file and then
reads and displays it.
28. Demonstrate the use of the os module to rename a file and delete it afterward.
29. Create a program that reads a CSV file and displays each row in a formatted output.

Unit 7: Common Python Libraries (Numpy, Pandas, Matplotlib)

30. Using NumPy, write a program to generate a 3x3 matrix of random integers and find the
maximum and minimum values.
31. Create a scatter plot using Matplotlib for two lists representing the x and y coordinates of
points.
32. Use Matplotlib to create a bar graph of student scores for five subjects and display the
title and labels.
33. Implement a program to use Numpy arrays and demonstrate basic slicing and reshaping.

Unit 8: Advanced Topics

34. Write a program to connect to an SQL database and insert a new record into a table and
display it.
35. Implement a basic GUI calculator using tkinter.

You might also like