0% found this document useful (0 votes)
7 views4 pages

Python Programming Challenges and Solutions

Uploaded by

M K Khaing
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Python Programming Challenges and Solutions

Uploaded by

M K Khaing
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

Write a Python function that takes a sequence of numbers and determines


whether all the numbers are different from each other.

2. Write a Python program that creates all possible strings using the letters 'a', 'e',
'i', 'o', and 'I'. Ensure that each character is used only once.

3. Write a Python program that removes and prints every third number from a list
of numbers until the list is empty.

4. Write a Python program to identify unique triplets whose three elements sum
to zero from an array of n integers.

5. Write a Python program to make combinations of 3 digits.

6. Write a Python program that prints long text, converts it to a list, and prints all
the words and the frequency of each word.

7. Write a Python program to count the number of each character in a text file.

8. Write a Python program that retrieves the top stories from Google News.

9. Write a Python program to get a list of locally installed Python modules.

10. Write a Python program to display some information about the OS where the
script is running.

11. Write a Python program to check the sum of three elements (each from an
array) from three arrays is equal to a target value. Print all those three-element
combinations.
Sample data:
/*
X = [10, 20, 20, 20]
Y = [10, 20, 30, 40]
Z = [10, 30, 40, 20]
target = 70
*/

12. Write a Python program that generates a list of all possible permutations from
a given collection of distinct numbers.

13. Write a Python program to get all possible two-digit letter combinations from
a 1-9 digit string.
string_maps = {
"1": "abc",
"2": "def",
"3": "ghi",
"4": "jkl",
"5": "mno",
"6": "pqrs",
"7": "tuv",
"8": "wxy",
"9": "z"
}

14. Write a Python program to add two positive integers without using the '+'
operator.
Note: Use bit wise operations to add two numbers.

15. Write a Python program to check the priority of the four operators (+, -, *, /).
16. Write a Python program to get the third side of a right-angled triangle from
two given sides.

17. Write a Python program to get all strobogrammatic numbers that are of length
n.
A strobogrammatic number is a number whose numeral is rotationally symmetric,
so that it appears the same when rotated 180 degrees. In other words, the
numeral looks the same right-side up and upside down (e.g., 69, 96, 1001).
For example,
Given n = 2, return ["11", "69", "88", "96"].
Given n = 3, return ['818', '111', '916', '619', '808', '101', '906', '609', '888', '181',
'986', '689']

18. Write a Python program to find the median among three given numbers.

19. Write a Python program that finds the value of n when n degrees of number 2
are written sequentially on a line without spaces between them.

20. Write a Python program to find the number of zeros at the end of a factorial of
a given positive number.
Range of the number(n): (1 <= n <= 2*109).
Activity 25

You might also like