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

Python

The document provides 13 Python programming problems/exercises including: calculating a to the power of b, finding the max of 3 numbers, counting uppercase and lowercase letters in a string, creating a list of unique elements from another list, printing even numbers from a list, creating and printing a list of squares between 1-30, finding numbers divisible by 7 and a multiple of 5 between 1500-2700, converting between Celsius and Fahrenheit, reversing a word, counting occurrences of an element in an array, removing the first occurrence of an element from an array, and finding the first duplicate element in an array or returning -1 if none exist.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Python

The document provides 13 Python programming problems/exercises including: calculating a to the power of b, finding the max of 3 numbers, counting uppercase and lowercase letters in a string, creating a list of unique elements from another list, printing even numbers from a list, creating and printing a list of squares between 1-30, finding numbers divisible by 7 and a multiple of 5 between 1500-2700, converting between Celsius and Fahrenheit, reversing a word, counting occurrences of an element in an array, removing the first occurrence of an element from an array, and finding the first duplicate element in an array or returning -1 if none exist.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Write a Python program to calculate the value of 'a' to the power 'b'
2. Write a Python function to find the Max of three numbers.
3. Write a Python function that accepts a string and calculate the number of
upper case letters and lower case letters.
4. Write a Python function that takes a list and returns a new list with unique
elements of the first list.
Sample List : [1,2,3,3,3,3,4,5]
Unique List : [1, 2, 3, 4, 5]
5. Write a Python program to print the even numbers from a given list.
6. Write a Python function to create and print a list where the values are
square of numbers between 1 and 30 (both included).
7. Write a Python program to find those numbers which are divisible by 7 and
multiple of 5, between 1500 and 2700 (both included).
8. 2. Write a Python program to convert temperatures to and from celsius,
fahrenheit.
[ Formula : c/5 = f-32/9 [ where c = temperature in celsius and f =
temperature in fahrenheit ]
Expected Output :
60°C is 140 in Fahrenheit
45°F is 7 in Celsius
9. Write a Python program that accepts a word from the user and reverse it.
10. Write a Python program to get the number of occurrences of a specified
element in an array.
Sample Output:
Original array: array('i', [1, 3, 5, 3, 7, 9, 3])
Number of occurrences of the number 3 in the said array: 3
11. Write a Python program to remove the first occurrence of a specified
element from an array.
Sample Output:
Original array: array('i', [1, 3, 5, 3, 7, 1, 9, 3])
Remove the first occurrence of 3 from the said array:
New array: array('i', [1, 5, 3, 7, 1, 9, 3])
12. Write a Python program to find the first duplicate element in a given array
of integers. Return -1 If there are no such elements.
Sample Output:
4
-1
1
13.

You might also like