You are on page 1of 3

---------------------------------------

Numbers------------------------------------------
#N1. Find the lcm of two numbers

#N2. Print table of given number till 10

#N3. Revrerse a number without using loop

#N4. Reverse a number using a loop

#N5. Check if a number is armstrong number ( Example : 153 = 1^3 + 5^3 + 3^3)

#N6. print all prime within a given range (Example :0-10 will print 2,3,5,7)

#N7. Compute prime factros of a integer (Example: prime factors of 60 are [2,3,5]

#N8. Check if a number is a palindrome

#N8. Check if a number input by user is divisible by only 2, only 3, both 2 and 3
or none

#N9. Check if a number input by user is between said range.


Example : Pre-defined range : (0-100)
User_input = 123
Output: Number out of range. Please re-enter number.
Use While Loop and Loop control statement

#N10. Print fibanacci series using:


a. For loop (First ten numbers in the series)
b. While loop (Numbers in the series till 1000)

--------------------------------------
Strings-------------------------------------------
#s1. Replace all occurances of 'a' with '$' in a string (Example: car becomes c$r)

#s2. Detect if two string are anagrams (Example: 'jar' and 'raj' are anagrams)

#s3. Count the numbers of vowels in a string (Example: "Aware" will return 3)

#s4. Form a new string where the first charcater and the last character has been
exchanged

#s5. Remove the characters of odd index value in a string (Use slicing and step)

#s6. Calculate the number of words and the number of characters in a string
(Make sure to check for extra spaces)

#s7. Reverse a string without slicing

#s8. Check if a string is palindrome (Example: civic, kayak will return yes)

#s9. Form a new string made of the first two and last two characters from a given
string

#s10. Calculate number of upper and lower case cahracters in a string:


Example: Input = "The quick Brown Fox"
Output upper: 3 Lower: 13
#s11. Calculate the length of character and digits in a string.(Hint: Use string
methods)
Example: Input : "abc123cba"
Output : length_char = 6 length_digits = 3

#s12. Reverse a string using loop. Cannot use slicing.


------------------------------------
List------------------------------------------------
#L0. Print sum of negative numbers, positive even numbers and positive odd numbers
in a list [1,2,3,4,5,-9,-6]

#L1. Write a Python program to check a list is empty or not

#L2. Write a Python program to print sum and multiply all the items in a list

#L3. Find the largest and smallest number in a list without using max and min
method

#L4. Write a Python program to remove duplicates from a list

#L5. Sort in increasing order by the last element in each tuple from a given list
containg list with two integers. ( User defined functions knowledge will be
required)
Example: Input List [[2, 5], [2, 3], [4, 4], [1, 2], [2, 1]]
Output List[[2, 1], [1, 2], [2, 3], [4, 4], [2, 5]]

#L6. Write a Python program to append a list to the second list

#L7. Write a Python program to convert a list of multiple integers into a single
integer.
Example : Input List: [1,2,3]
Output 123
Similarly input a number and form a list with all the digits as items in
list
Example : Input Number: 123
Output [1,2,3]

#L8. Write a Python program to iterate over two lists simultaneously.


(Hint: use zip function)
Example: List1=[1,2,3]
List2=['a','b','c']
Output : 1 a
2 b
3 c

#L9. W.A.P. to remove duplicates from a list

#L10. W.A.P. to add a list to a list without using append or insert or extend
method
Example: L1=[1,2,3]
L2=[4,5,6]
Hint(Use slicing to extend the list - Try playing around with it)

#L11. Create and print a list containing sqaures from 1 and user_input(Less than
50)
Example: Input : 5
Output : [1,4,9,16,25]
Input: 60
Output: Number out of range. Please reenter. To exit press y
Use Loop, conditonal checks and comparison operators

#L12. Find the second largest number in a list.


Note: List can have repeating numbers as well
-------------------------------------
Dictionary----------------------------------------

#D1. Add a key value pair to the dictionary

#D2. Remove given key in a dict

#D3. Concatenate two dict in one dictionary (Use dictionary methods)

#D4. Map two list of same length into a dictionary


a. Use a temp list to create a list of list and then just typecast it as
dictionary
b. Use zip function

#D5. Create a dict with key as first character and value as words starting with
that character (Use split method for strings)
Example : User_input : "This is a good day"
Output : {'T':'This', 'i':'is, 'a':'a', 'g':'good', 'd':'day'}

#D6. Create a dictionary with squares of number as value and number as key
Example : Input : Enter a number:: 5
Output : {1:1, 2:4, 3:9, 4:16, 5:25}

----------------------------------------
Set--------------------------------------------
#Set1. Count the number of vowels present in a string using sets

#Set2. Check common letters in two strings

You might also like