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

Lab Assignment

The document contains instructions for 13 Python programming assignments covering basic concepts like identifying even/odd numbers, calculating sums and factorials, as well as more advanced concepts involving string manipulation, lists, tuples, and dictionaries. The assignments include writing scripts to check for prime numbers, abbreviate names, find string lengths, remove repeated list elements, store gymnast scores in tuples, and sort a student marks dictionary.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
561 views

Lab Assignment

The document contains instructions for 13 Python programming assignments covering basic concepts like identifying even/odd numbers, calculating sums and factorials, as well as more advanced concepts involving string manipulation, lists, tuples, and dictionaries. The assignments include writing scripts to check for prime numbers, abbreviate names, find string lengths, remove repeated list elements, store gymnast scores in tuples, and sort a student marks dictionary.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment 1

Date of Submission: 7th Feb 2020

Basic Python Programs


1. Write a python script to get a number from user and identify it as even or odd.
2. Write a python script to print the sum of numbers from 1-50.
3. Write a python script to print the sum of numbers in a range. Range entered by user.
4. Write a python script to check whether a number is prime or not.
5. Write a python script to get a number from user print factorial of that number.

String Manipulation
6. Write a program to create a new string with all the consonants deleted from the string
"Hello, have a good day".
7. Write a program that takes your full name as input and displays the abbreviations of the
first and middle names except the last name which is displayed as it is. For example, if
your name is Robert Brett Roser, then the output should be R.B.Roser.
8. Write the string after the first occurrence of ',' and the string after the last occurrence of
',' in the string "Hello, Good, Morning, World".
9. Write a program to find the length of the string "refrigerator" without
using len function.
List
10. Take 10 integer inputs from user and store them in a list. Again ask user to give a
number. Now, tell user whether that number is present in list or not.
11. Make a list by taking 10 input from user. Now delete all repeated elements of the list.
E.g.-INPUT : [1,2,3,2,1,3,12,12,32]
OUTPUT : [1,2,3,12,32]
Tuple

12. A gymnast can earn a score between 1 and 10 from each judge; nothing lower,
nothing higher. There are a total of 5 judges. All scores are integer values; there
are no decimal scores from a single judge. Store the scores for one gymnast in a
tuple for 5 gymnasts. Print out the sentence, "The lowest possible score is ___, and
the highest possible score is ___." Use the values from your tuple. Also print the
list of scores as, "Gymnast x scored y scores", where x is the number of the
gymnast and y is the average score obtained.

Dictionary
13. Ask user to give name and marks of 10 different students. Store them in dictionary.
Sort the dictionary according to marks.

You might also like