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

python file 04

Uploaded by

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

python file 04

Uploaded by

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

INDEX

Sl.No. Title of the Program Page Number Sign.


01 Print your name and address details to the 01
screen.
02 Add two numbers and display the result 01
03 Calculate the area of a circle given its 02
radius.
04 Ask for a number and check if it's positive 02
or negative
05 Check if a given number is even or odd. 03
06 Implement a basic calculator (addition, 03
subtraction, multiplication, division).
07 Swap the values of two numbers without 04
using a temporary variable.
08 Determine whether a given year is a leap 05
year or not.
09 Print a multiplication table for a given 06
number.
10 Print the Fibonacci sequence up to a 07
specified number of terms.
11 Calculate the factorial of a given number. 08
12 Check if a number is prime or not. 08
13 Reverse a string entered by the user. 09
14 Count the number of vowels in a string. 09
15 Check if a given string is a palindrome. 10
16 Count the number of words in a sentence. 10
17 Find the sum of natural numbers up to a 11
given limit.
18 Print a simple star pattern (e.g., a triangle). 11
19 Check if a number is an Armstrong number. 12
20 Find the sum of digits of a given number. 13
21 Find the largest of three given numbers. 14

22 Convert a temperature from Celsius to 15


Fahrenheit.
23 Calculate simple interest for a given 15
principal, rate, and time.
24 Calculate compound interest. 16
25 Find the GCD of two numbers. 17
26 Find the LCM of two numbers. 17
27 Check if a number is a perfect number. 18
28 Sum all the elements in a list. 19
29 Find the largest element in a list. 19
30 Find the smallest element in a list. 20
31 Remove duplicates from a list. 20
32 Sort a list of numbers in ascending order. 21
33 Reverse the elements of a list. 21
34 Count the occurrences of an element in a 22
list.
35 Find the sum of all odd numbers in a list. 22
36 Find common elements between two lists. 23
37 Return the intersection of two lists. 23
38 Return the union of two lists. 24
39 Create a list of square numbers. 24
40 Find the second largest number in a list. 25
41 Generate a random number between two 25
values.
42 Check if a number is divisible by 5 and 10. 26
43 Print all prime numbers within a range. 26
44 Check if a number is a palindrome. 27
45 Find the missing number in a list of 27
numbers.
46 Concatenate two lists into one. 28
47 Create a dictionary and perform operations 28
like adding and removing items.
48 Find the value of a given key in a 29
dictionary.
49 Update the value of a specific key in a 29
dictionary.
50 Merge two dictionaries. 30
51 Count the frequency of elements in a list. 31
52 Count occurrences of a word in a sentence. 31
53 Count the frequency of each word in a text 32
file.
54 Remove all whitespaces from a string. 33
55 Find the longest word in a given sentence. 33
56 Count how many times each letter appears 34
in a string.
57 Concatenate two strings. 35
58 Find all substrings of a string. 35
59 Replace a part of a string with another 36
substring.
60 Convert a string to uppercase. 36
61 Convert a string to lowercase. 37
62 Check if a string contains a specific 37
substring.
63 Check if a number is a power of two. 38
64 Count the digits in a number. 38
65 Create and print a 2D matrix. 39
66 Find the transpose of a matrix. 40
67 Find the sum of diagonal elements in a 41
matrix.
68 Multiply two matrices. 42
69 Add two matrices. 45
70 Convert a decimal number to binary. 48
71 Convert a binary number to decimal. 48
72 Find the length of a given string. 49
73 Convert a list of characters into a string. 49
74 Compare two strings and return if they are 50
the same.
75 Find the most frequent number in a list. 50
76 Reverse a given number. 51
77 Find the sum of even numbers in a list. 52
78 Extract numbers from a given string. 52
79 Alphabet Characters from a String. 53
80 Generate Fibonacci numbers up to a given 53
count.
81 Find the largest prime factor of a number. 54
82 Calculate the sum of all divisors of a 55
number.
83 Sum all divisors of a number excluding the 55
number itself.
84 Check if a number is divisible by the sum of 56
its digits.
85 Find all divisors of a number. 56
86 Check if a string contains only numeric 57
digits.
87 Check if a string contains only letters. 57
88 Count the consonants in a string. 58
89 Check if a list is sorted in ascending order. 58
90 Find the second smallest element in a list. 59
91 Remove an item from a list using its value. 60
92 Sum the first N odd numbers. 60
93 Check if a list is a palindrome. 61
94 Generate a random alphanumeric password 61
of the given length.
95 Check if one string is a substring of another. 62
96 Find elements in the first list not in the 63
second.
97 Sort a list of tuples based on the second 63
item.
98 Create a dictionary by pairing elements 63
from two lists.
99 Find the sum of all elements in a 2D list. 64
100 Find the median of a list of numbers. 64

You might also like