Skip to content

About

A collection of 60 Python programming assignments covering fundamental to intermediate concepts, including variables, data types, conditional statements, loops, functions, strings, lists, object-oriented programming (OOP), exception handling, algorithms, and problem-solving.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

PYTHON LAB ASSIGNMENT [BCS354]

STUDENT DETAILS

S.No. Particulars Details
1 Name Ayush Kumar
2 Course B.Tech [CSE]
3 Year 2nd Year
4 Semester 3rd Semester
5 Student ID BCS2024552
6 Subject Name Python Lab
7 Subject Code BCS354

1. Introduction

Python is a high-level, interpreted, and general-purpose programming language. It is widely used in software development, automation, data science, artificial intelligence, and web development.

This assignment contains Python programming questions covering basic, intermediate, and advanced concepts. The programs are written using simple logic and beginner-friendly approaches to improve programming skills and problem-solving abilities.

2. Objectives

  • To understand Python programming fundamentals.
  • To develop logical and problem-solving skills.
  • To understand conditional statements and loops.
  • To learn functions and recursion.
  • To work with strings, lists, and arrays.
  • To understand Object-Oriented Programming.
  • To learn exception handling and file handling.
  • To explore advanced Python concepts.

3. List of All 12 Topics

1. Variables and Data Types

  • Swap Two Variables Without Using a Temporary Variable.
  • Check the Type of a Variable.
  • Declare and Initialize Variables.
  • Sum of Two Numbers Using Variables.

2. Conditional Statements

  • Check if a Number is Positive, Negative, or Zero.
  • Find the Largest of Three Numbers Using If-Else.
  • Check if a Person is Eligible to Vote.
  • Check if a Year is a Leap Year.

3. Functions

  • Create a Function to Calculate the Square of a Number.
  • Write a Function to Check if a Number is Prime.
  • Write a Recursive Function to Calculate Factorial.
  • Write a Function to Convert Celsius to Fahrenheit.
  • Write a Function to Find the Maximum Element in a List.

4. Loops

  • Display the Multiplication Table of a Number.
  • Sum of Digits Using a While Loop.
  • Display the Fibonacci Sequence up to N Terms.
  • Print the Factorial of a Number Using a For Loop.

5. String Manipulation

  • Check if a String is a Palindrome.
  • Remove Spaces from a Given String.
  • Capitalize First and Last Letters of a Given String.
  • Remove Duplicate Characters in a String.
  • Count the Number of Occurrences of 'o' in a String.

6. Lists and Arrays

  • Find the Largest Element in a List.
  • Create a List of Even Numbers from a List.
  • Remove Duplicates from a List.
  • Check if a List is Sorted in Ascending Order.
  • Merge Two Lists into One.

7. Advanced Functions and Algorithms

  • Find the GCD of Two Numbers.
  • Find the LCM of Two Numbers.
  • Check if a List is a Palindrome.
  • Find the Sum of All Odd Numbers from 1 to 100.
  • Calculate the Sum of All Natural Numbers.

8. Object-Oriented Programming

  • Design a Simple Banking System.
  • Create a Class for a Student with Marks and Grade.
  • Create a Class to Represent a Rectangle.

9. Error Handling and Debugging

  • Handle Division by Zero Using Try-Except.
  • Handle Multiple Exceptions.
  • Handle File Not Found Error.

10. Number Theory

  • Check if a Number is Prime.
  • Find the Sum of All Divisors of a Number.
  • Check if a Number is Perfect.
  • Count the Number of Digits in a Number.

11. Miscellaneous

  • Generate a Random OTP Using Python.
  • Convert Decimal to Binary Using Functions.
  • Sort a List Without Using Built-In Sort Function.
  • Find the Intersection of Two Lists.
  • Sum of All Even Numbers from 1 to 100.
  • Sum of All Odd Numbers from 1 to 100.
  • Calculate the Sum of All Prime Numbers from 1 to 100.
  • Check if a String is an Anagram of Another String.

12. Advanced Python Concepts

  • Create a Decorator to Calculate Function Execution Time.
  • Generate Prime Numbers Using Generators.
  • Create a Custom Context Manager.
  • Create a Banking System Using Custom Exceptions.
  • Create a Contact Book Using JSON.
  • Develop a Library Management System Using OOP and Inheritance.
  • Find the Shortest Path in a Graph Using BFS.
  • Solve the N-Queens Problem Using Backtracking.
  • Execute Multiple Tasks Using Multithreading.
  • Execute Multiple Tasks Using Asyncio.

4. Folder Structure

Python_Assignment/
├── 01_variables_and_data_types/
├── 02_conditional_statements/
├── 03_functions/
├── 04_loops/
├── 05_string_manipulation/
├── 06_lists_and_arrays/
├── 07_advanced_functions_and_algorithms/
├── 08_object_oriented_programming/
├── 09_error_handling_and_debugging/
├── 10_number_theory/
├── 11_miscellaneous/
└── 12_advanced_questions/

5. Software Requirements

  • Python 3.8 or above.
  • Visual Studio Code.
  • Python Extension in VS Code.
  • Windows, Linux, or macOS.
  • Terminal or Command Prompt.

6. How to Execute Programs

  1. Install Python on your computer.
  2. Open Visual Studio Code.
  3. Open the assignment folder.
  4. Select the Python file you want to execute.
  5. Open the integrated terminal.
  6. Run the following command:
  • python filename.py
  1. Enter the required input and check the output.

7. Learning Outcomes

After completing these assignments, I have gained practical knowledge of:

  • Python syntax and programming fundamentals.
  • Variables, data types, and operators.
  • Conditional statements and looping.
  • Functions and recursive programming.
  • String and list manipulation.
  • Algorithms and number theory.
  • Object-Oriented Programming.
  • Exception and file handling.
  • Decorators and generators.
  • Graph algorithms and backtracking.
  • Multithreading and asynchronous programming.

8. Conclusion

Through these Python Lab assignments, I have practised different programming concepts, from basic Python fundamentals to advanced programming techniques.

These programs helped me improve my logical thinking, coding skills, and understanding of Python. They also provided practical exposure to problem-solving, algorithms, Object-Oriented Programming, and advanced Python features.

I will continue practising these concepts to improve my programming knowledge and develop more efficient solutions.

About

A collection of 60 Python programming assignments covering fundamental to intermediate concepts, including variables, data types, conditional statements, loops, functions, strings, lists, object-oriented programming (OOP), exception handling, algorithms, and problem-solving.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages