XIA CS WINTER BREAK HOMEWORK
XIA CS WINTER BREAK HOMEWORK
XIA CS WINTER BREAK HOMEWORK
COMPUTER SCIENCE
WINTER BREAK HOMEWORK [2024-25]
4. A list is declared as
Lst = [1,2,3,4,5,6,8]
What will be the value of sum(Lst)?
7. Write the output of the following questions on the basis of the string
str1=’Digital India’
I. print (str1 [ 3: :2] )
II. print (str1[ : : -1 ] )
III. print(str1[ 4 : 9 ] )
IV. print(str1.isalpha( ) )
V. print(str1.find ( ‘India’ ) )
11. Write a program to input numbers in a list and print the sum of even numbers present in
list.
12. Write a program to input numbers in list from user and change even number by its half and
odd numbers by its double.
For example if L=[1,2,3,4,5,6,7,8]
Then program will display list [2,1,6,2,10,3,14,4]
13. Write a python code to accept a list of 10 elements from the user and and display the
following
1. Sum of negative numbers
2. Sum of positive even numbers
3. Sum of positive odd numbers
For example : if list is L1=[5,9,-4,12,-3,7,-15,11,2]
Output should be
1. Sum of negative numbers : -22
2. Sum of positive even numbers : 14
3. Sum of positive odd numbers : 32
14. Write a program to input a string and print number of uppercase and lowercase letters in
it.
For Example: If a user enters a string as given below: string="Strings in Python" Then the output
should be:
Number of uppercase letters: 2
Number of lowercase letters: 13
15. Write a program to input a string and print a new string that capitalizes every second letter in the
original string.
Eg.-computer becomes cOmPuTeR