Lab Assignment
Lab Assignment
1. Write a Python program to calculate the area of a circle given its radius.
2. Create a program that takes user input for a temperature in Celsius and converts it to
Fahrenheit.
3. Implement a calculator that performs basic arithmetic operations (addition, subtraction,
multiplication, division) based on user input.
4. Write a program that checks if a number is even or odd.
5. Develop a function that takes a string as input and returns the string reversed.
6. Create a program that asks the user for their age and prints whether they are a minor,
adult, or senior.
7. Write a program that evaluates three numbers and prints the largest one.
8. Implement a program that gives feedback based on a user's score (A, B, C, D, F).
9. Write a program to check if a year is a leap year.
10. Develop a simple login system that checks a username and password.
11. Write a Python program that counts the number of vowels in a given string.
12. Create a function that removes all whitespace from a user-inputted string.
13. Implement a program to check if two strings are anagrams of each other.
14. Write a program to count the frequency of words in a given sentence.
15. Create a function that replaces every occurrence of a substring with another substring in
a string.
16. Write a program that generates the first 10 Fibonacci numbers using iteration.
17. Create a program that sums all even numbers from 1 to 100.
18. Write a Python script that prints the multiplication table of a user-defined number.
19. Develop a program that calculates the factorial of a number using a loop.
20. Create a function that lists all prime numbers up to a specified limit.
21. Write a function that calculates the greatest common divisor (GCD) of two numbers.
22. Create a Python function that takes a list of numbers and returns the largest number.
23. Implement a function for finding the factorial of a number using recursion.
24. Write a program that utilizes global variables and demonstrates their use in functions.
25. Develop a module that contains utility functions for string manipulations.
26. Write a simple testing script that verifies the functionality of your calculator from a
previous assignment.
27. Create a program that includes debugging statements to show the flow of execution.
28. Implement a function and write unit tests to confirm its correctness using assertions.
29. Write a program that intentionally has a bug, and then demonstrate how to fix it.
30. Create a logging system that tracks function calls and their parameters.
31. Write a Python script to demonstrate the usage of tuples for storing coordinates.
32. Create a program that uses lists and demonstrates mutability by modifying the list
items.
33. Implement a higher-order function that takes another function as an argument and
applies it to a list.
34. Write a program to simulate a simple inventory system using dictionaries.
35. Create a function that sorts a list of dictionaries by a specified key.
36. Write a program that reads a file and handles exceptions if the file does not exist.
37. Create a function that raises an exception if the input is not a positive number.
38. Implement a program that uses assertions to check the validity of user input.
39. Write a function to demonstrate the use of try-except blocks when dividing numbers.
40. Create a program that captures and logs exceptions thrown in a mathematical
computation.
41. Define a class for a Rectangle that calculates the area and perimeter.
42. Create a class that models a BankAccount with methods to deposit and withdraw funds.
43. Implement inheritance by creating a Circle class that inherits from a Shape class.
44. Write a program that demonstrates encapsulation through private class members.
45. Create an abstract class Animal with subclasses for Dog and Cat.
46. Implement a binary search algorithm on a sorted list of numbers.
47. Write a sorting algorithm (e.g., bubble sort) and test its functionality.
48. Create a program that utilizes a hashtable to store and retrieve key-value pairs.
49. Develop a function that sorts a list of dictionaries based on the values of a specific key.
50. Write a program that implements a breadth-first search for a graph structure.
51. Use Matplotlib to plot a simple line graph representing a mathematical function.
52. Create a program that plots a scatter plot for random data points.
53. Implement a bar chart visualizing sales data over a month.
54. Write a program that demonstrates plotting the Fibonacci sequence with PyLab.
55. Create a function that plots the trajectory of a projectile motion.
56. Implement the 0/1 knapsack algorithm to solve a simple problem.
57. Write a dynamic programming solution for finding the longest common subsequence.
58. Create a program to visualize dynamic programming approaches for the Fibonacci
sequence.
59. Develop a divide-and-conquer algorithm to sort an array.
60. Write a Python function that uses memoization to optimize a recursive problem.
61. Create an application that manages a library system with classes for Book and Library.
62. Implement a simple game (e.g., Guess the Number) using branching and loops.
63. Write a Python program that scrapes data from a website and processes it.
64. Develop a weather application that retrieves data from an API and displays it using
plots.
65. Create a ToDo application using classes and file handling to save tasks.
66. Write a function that converts a number to its binary string representation.
67. Create a program to generate random passwords with specified complexity.
68. Implement a text-based version of tic-tac-toe.
69. Write a script that applies basic text analysis on a provided text file.
70. Develop a simple task scheduler that runs functions at specified intervals.
71. Create a budgeting application that tracks expenses using classes.
72. Write a program that analyzes and visualizes stock market data.
73. Develop a Python script that automates file organization based on file types.
74. Create a system for monitoring server performance metrics and notifying on anomalies.
75. Build a simple e-commerce cart system using classes and functions.
76. Implement a user authentication system with classes and file storage.
77. Design a quiz application that evaluates user knowledge using functions and data
structures.
78. Create a simulation of a simple traffic light system.
79. Develop a content management system using object-oriented principles and file
handling.