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

100 Days 100 Python Programs

The document presents 100 beginner-level Python programs categorized into Basic Programs, Control Flow Statements, Loops, Lists, Strings, Functions and Methods, File Input/Output, Classes and Objects, Exception Handling, and Advanced Concepts. Each program includes a brief description of its functionality, aimed at helping learners build a strong foundation in Python programming. Additionally, it offers tips for effective learning and coding practices.

Uploaded by

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

100 Days 100 Python Programs

The document presents 100 beginner-level Python programs categorized into Basic Programs, Control Flow Statements, Loops, Lists, Strings, Functions and Methods, File Input/Output, Classes and Objects, Exception Handling, and Advanced Concepts. Each program includes a brief description of its functionality, aimed at helping learners build a strong foundation in Python programming. Additionally, it offers tips for effective learning and coding practices.

Uploaded by

Yatharth Chauhan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Sure! Here are 100 beginner-level Python programs organized into categories.

These exercises will help


you understand basic concepts and build a strong foundation in Python programming. Let's get started:

---

### **Basic Programs**

1. **Hello World**

- Print "Hello, World!" to the console.

2. **Print Your Name**

- Input your name and display a greeting.

3. **Simple Addition**

- Add two numbers provided by the user.

4. **Arithmetic Operations**

- Perform addition, subtraction, multiplication, and division.

5. **Swap Two Numbers**

- Swap values of two variables with and without a temporary variable.

6. **Area and Perimeter of a Rectangle**

- Calculate based on user input for length and width.

7. **Area and Circumference of a Circle**

- Compute using the radius provided by the user.

8. **Temperature Conversion**
- Convert Fahrenheit to Celsius and vice versa.

9. **Simple Interest Calculator**

- Calculate simple interest based on principal, rate, and time.

10. **Compound Interest Calculator**

- Compute compound interest for given values.

---

### **Control Flow Statements**

11. **Even or Odd**

- Determine if a number is even or odd.

12. **Positive or Negative Number**

- Check if a number is positive, negative, or zero.

13. **Largest of Three Numbers**

- Find the largest among three user-input numbers.

14. **Leap Year Checker**

- Determine if a given year is a leap year.

15. **Grade Calculator**

- Assign grades based on marks using if-else statements.

16. **Vowel or Consonant**

- Check whether an input character is a vowel or consonant.


17. **Simple Calculator Using If-Else**

- Perform basic arithmetic operations based on user choice.

18. **Number Guessing Game**

- Allow the user to guess a randomly generated number.

---

### **Loops**

21. **Print Numbers from 1 to N**

- Use a loop to print numbers from 1 up to N.

22. **Sum of Natural Numbers**

- Calculate the sum of natural numbers up to N.

23. **Multiplication Table**

- Display the multiplication table of a given number.

24. **Factorial of a Number**

- Compute the factorial using a loop.

25. **Fibonacci Series**

- Generate Fibonacci series up to N terms.

26. **Reverse a Number**

- Reverse the digits of an integer.

27. **Palindrome Number**


- Check if a number is a palindrome.

28. **Armstrong Number**

- Determine if a number is an Armstrong number.

29. **Prime Number Checker**

- Check if a number is prime.

30. **Print Prime Numbers in a Range**

- Display all prime numbers between two intervals.

31. **Sum of Digits**

- Calculate the sum of the digits of a number.

32. **ASCII Values**

Display ASCII values for characters 0-255

33. **ASCII Values**

- Display ASCII values for characters 0-127

34. **HCF and LCM**

- Find the Highest Common Factor and Least Common Multiple.

35. **Count Number of Digits**

- Count the number of digits in an integer.

36. **Power of a Number**

- Calculate X^Y without using built-in functions.


37. **Binary to Decimal Conversion**

- Convert a binary number to decimal.

38. **Decimal to Binary Conversion**

- Convert a decimal number to binary.

39. **Sum of Even and Odd Numbers**

- Calculate sums of even and odd numbers in a range.

40. **GCD Using Euclidean Algorithm**

- Find GCD of two numbers using loops.

---

### **Lists**

41. **List Element Input and Output**

- Input elements into a list and display them.

42. **List Sum and Average**

- Find the sum and average of list elements.

43. **Find Largest and Smallest in List**

- Identify the largest and smallest elements in a list.

44. **Reverse a List**

- Reverse the elements of a list.

45. **Duplicate Elements in List**


- Find and display duplicate elements.

46. **Merge Two Lists**

- Merge two lists into a third list.

47. **List Sorting**

- Sort the elements using bubble sort or selection sort.

48. **Second Largest Element**

- Find the second largest element in a list.

49. **Frequency of Elements**

- Count the frequency of each element in a list.

50. **Matrix Addition**

- Add two matrices provided by the user.

51. **Matrix Multiplication**

- Multiply two matrices.

52. **Transpose of a Matrix**

- Find the transpose of a given matrix.

53. **Sparse Matrix Representation**

- Represent a sparse matrix efficiently.

54. **Remove Duplicates from List**

- Create a list without duplicate elements.


55. **Cyclically Permute List Elements**

- Rotate list elements to the right or left.

---

### **Strings**

56. **String Input and Output**

- Accept a string from the user and display it.

57. **String Length**

- Find the length of a string without using built-in functions.

58. **String Comparison**

- Compare two strings for equality.

59. **String Concatenation**

- Concatenate two strings without using built-in functions.

60. **Substring Extraction**

- Extract a substring from a given string.

61. **Character Frequency**

- Count the frequency of each character in a string.

62. **Palindrome String**

- Check if a string is a palindrome.

63. **Anagram Checker**


- Check if two strings are anagrams.

64. **Vowel and Consonant Counter**

- Count the number of vowels and consonants in a string.

65. **Word Count in a String**

- Count the number of words in a sentence.

66. **Reverse a String**

- Reverse the string without using built-in functions.

67. **Toggle Case of Characters**

- Change uppercase letters to lowercase and vice versa.

68. **Remove Whitespace**

- Remove all white spaces from a string.

69. **Find Duplicate Words**

- Identify duplicate words in a sentence.

70. **String to Integer Conversion**

- Convert a numeric string to an integer.

---

### **Functions and Methods**

71. **Simple Functions**

- Write functions for addition, subtraction, etc.


72. **Recursive Factorial**

- Calculate factorial using recursion.

73. **Recursive Fibonacci**

- Generate Fibonacci series using recursion.

74. **Prime Number Function**

- Check if a number is prime using a function.

75. **GCD and LCM Functions**

- Find GCD and LCM using functions.

76. **Overloaded Functions**

- Demonstrate method overloading.

77. **Pass by Value and Reference**

- Show the difference in function calling.

---

### **File Input/Output**

78. **File Reading**

- Read data from a text file.

79. **File Writing**

- Write data to a text file.


80. **Copy File Contents**

- Copy contents from one file to another.

81. **Count Words in File**

- Count the number of words in a file.

---

### **Classes and Objects**

82. **Class and Object Creation**

- Create a simple class and instantiate objects.

83. **Constructor Usage**

- Demonstrate default and parameterized constructors.

84. **Encapsulation**

- Implement encapsulation with getters and setters.

85. **Inheritance Example**

- Show single and multilevel inheritance.

86. **Method Overriding**

- Demonstrate method overriding in subclasses.

87. **Abstract Classes**

- Use abstract classes and methods.

88. **Interfaces Implementation**


- Implement interfaces in classes.

89. **Polymorphism**

- Show compile-time and run-time polymorphism.

90. **Static Method and Variable**

- Demonstrate the use of static methods and variables.

---

### **Exception Handling**

91. **Try-Except Example**

- Handle exceptions using try-except blocks.

92. **Multiple Exceptions**

- Handle multiple exceptions in a program.

93. **Custom Exceptions**

- Create and use custom exception classes.

94. **Finally Block**

- Demonstrate the use of a finally block.

95. **Raise Exception**

- Use the raise keyword to throw an exception.

---
### **Advanced Concepts (Introductory)**

96. **Lambda Functions**

- Use lambda functions for short anonymous functions.

97. **List Comprehensions**

- Generate lists using list comprehensions.

98. **Generators**

- Implement generators using the yield keyword.

99. **Decorators**

- Use decorators to modify the behavior of functions.

100. **Context Managers**

- Use context managers with the `with` keyword.

---

### **Next Steps and Tips**

Working through these programs will give you hands-on experience with various aspects of Python
programming. Here are some tips to make the most out of these exercises:

- **Start Simple**: Begin with the basic programs and gradually move to more complex ones.

- **Understand the Concepts**: Don't just code—ensure you understand why you're writing each line.

- **Experiment**: Modify the programs to see different outcomes and reinforce learning.

- **Debug**: Learn to read error messages and debug your code.

- **Document Your Code**: Write comments to explain your logic; this is a good habit for future

You might also like