Assignment CS GR XI - list (1)
Assignment CS GR XI - list (1)
Fortnightly Assignment
1. Write a Python program to check whether a number entered by the user is prime or not.
2. Write a Python program to sum all the items in a list.
3. Write a Python program to find the product all the items in a list.
4. Write a Python program to get the largest number from a list.
5. Write a Python program to get the smallest number from a list.
6. Write a Python program to display :
a. Prime numbers from the list
b. Armstrong numbers from the list
c. Palindrome numbers from the list
7. Write a Python program to count the number of strings where the string length is 2 or more and the first and
last character are same from a given list of strings.
Sample List : ['abc', 'xyz', 'aba’, '1221']
Expected Result : 2
8. Write a Python program to find the list of words that are longer than n from a given list of words.
9. Write a Python program to print the numbers of a specified list after removing even numbers from it.
10. Return the sum of the numbers in the list, returning 0 for an empty list. Except the number 13 is very unlucky,
so it does not count and numbers that come immediately after a 13 also do not count.
[1, 2, 2, 1] → 6
[1, 1] → 2
[1, 2, 2, 1, 13, 4, 1] → 7
11. Display the sum of the numbers in the list, except ignore sections of numbers starting with a 6 and extending up
to the next 7 (every 6 will be followed by at least one 7).
sum67([1, 2, 2]) → 5
sum67([1, 2, 2, 6, 99, 99, 7]) → 5
sum67([1, 1, 6, 7, 2]) → 4
Page 1 of 1