Python Holiday Homework
Python Holiday Homework
list
1. Write a Python program to get the 4th element and 4th element from
last of a tuple.
2. Write a Python program to check whether an element exists within a
tuple.
3. Write a Python program to find the repeated items of a tuple.
4. Write a Python program to find the index of an item of a tuple.
5. Write a Python program convert a given string list to a tuple.
String:-
1. Write a Python program to count the number of characters (character
frequency) in a string
2. Write a Python program to get a string made of the first 2 and the last
2 chars from a given a string. If the string length is less than 2, return
instead of the empty string.
3. Write a Python program to get a string from a given string where all
occurrences of its first char have been changed to '$', except the first
char itself.
4. Write a Python program to get a single string from two given strings,
separated by a space and swap the first two characters of each
string.
5. Write a Python program to find the first appearance of the substring
'not' and 'poor' from a given string, if 'not' follows the 'poor', replace
the whole 'not'...'poor' substring with 'good'. Return the resulting
string.
6. Write a Python program to remove the characters which have odd
index values of a given string.
7. Write a Python script that takes input from the user and displays that
input back in upper and lower cases.
8. Write a Python program to check whether a string starts with
specified characters.
9. Write a Python program to display a number with a comma
separator.
10. Write a Python program to reverse words in a string.
Function:-
1. Write a Python function to find the Max of three numbers.
2. Write a Python function to sum all the numbers in a list
3. Write a Python program to print the even numbers from a given list
4. Write a Python function to check whether a number is perfect or not.
5. Write a Python function that checks whether a passed string is
palindrome or not.
Conditional statement:-