0% found this document useful (0 votes)
990 views3 pages

Python Holiday Homework

This document contains Python holiday homework assignments divided into different categories: tuples, strings, functions, and conditional statements. The tuple assignments involve accessing elements, checking for existence, finding repeated items, and finding indexes. The string assignments involve character counting, slicing, substitution, swapping, searching, removing odd indexes, handling cases, prefix checking, number formatting with commas, and reversing words. The function assignments involve finding the maximum of three numbers, summing a list, printing evens from a list, checking for perfect numbers, and checking for palindromes. The conditional statement assignments involve finding numbers divisible by 7 and a multiple of 5, guessing a number game, counting evens and odds, printing a range avoiding numbers, calculating digits and

Uploaded by

fake banda
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)
990 views3 pages

Python Holiday Homework

This document contains Python holiday homework assignments divided into different categories: tuples, strings, functions, and conditional statements. The tuple assignments involve accessing elements, checking for existence, finding repeated items, and finding indexes. The string assignments involve character counting, slicing, substitution, swapping, searching, removing odd indexes, handling cases, prefix checking, number formatting with commas, and reversing words. The function assignments involve finding the maximum of three numbers, summing a list, printing evens from a list, checking for perfect numbers, and checking for palindromes. The conditional statement assignments involve finding numbers divisible by 7 and a multiple of 5, guessing a number game, counting evens and odds, printing a range avoiding numbers, calculating digits and

Uploaded by

fake banda
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/ 3

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:-

1. Write a Python program to find those numbers which are divisible by


7 and multiple of 5, between 1500 and 2700 (both included)
2. Write a Python program to guess a number between 1 to 9.
Note : User is prompted to enter a guess. If the user guesses wrong
then the prompt appears again until the guess is correct, on
successful guess, user will get a "Well guessed!" message, and the
program will exit.
3. Write a Python program to count the number of even and odd
numbers from a series of numbers.
4. Write a Python program that prints all the numbers from 0 to 6 except
3 and 6.
5. Write a Python program that accepts a string and calculate the
number of digits and letters.
6. Write a Python program to sum of two given integers. However, if the
sum is between 15 to 20 it will return 20
7. Write a Python program to calculate the sum and average of n
integer numbers (input from the user). Input 0 to finish
8. Write a Python program to find the median of three values.

You might also like