Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a Python program to extract the nth element from a given list of tuples. Original list: [(Greyson Fulton, 98, 99). (Brady Kent', 97,
1. Write a Python program to extract the nth element from a given list of tuples. Original list: [(Greyson Fulton, 98, 99). (Brady Kent', 97, 96). (Wyatt Knott'. 91.94). ("Beau Turnbull.94.98)| Extract nth element (n=0) from the said list of tuples: Greyson Fulton Brady Kent', Wyatt Knott', 'Beau Turnbull') Extract nth element (n=2 ) from the said list of tuples 199, 96, 94,981 2. Write a Python program to multiply all the items in a dictionary 3. Write a Python program to print all unique values in a dictionary Sample Data : [l"V":"8001"). ("V": "5002"). ("Vr": "5001"). ("VI": "5005"). "VII":"500S"). ("V":"S009"). "VIII":"007" 11 Expected Output: Unique Values: (500S. S002', 'S007, S001", "3009) 4. Write a Python program to create a dictionary of keys x, y, and a where each key has as value a list from 11-20, 21-30, and 31-40 respectively. Access the fifth value of each key from the dictionary 1x: [11, 12, 13, 14, 15, 16, 17, 18, 19). :121, 22, 23, 24, 25, 26, 27, 28, 29). 2:31, 32, 33, 34, 35, 36, 37, 38, 391 15 25 35 x has value [11, 12, 13, 14, 15, 16, 17, 18, 191 y has value 21, 22, 23, 24, 25, 26, 27, 28, 29) z has value 31, 32, 33, 34, 35, 36, 37, 38, 39) 5. Write a Python program to print a tuple with string formatting Sample tuple: (100, 200, 300) Output: This is a tuple (100, 200, 300) 6. Write a Python program to replace last value of tuples in a list. Sample list: [(10, 20,40). (40,50,60), (70,80, 90)] Expected Output: (10, 20, 100),(40, 50, 100). (70, 80, 100) 7. Write a Python program to find the elements in a given set that are not in another set. 8. Write a Python program to check a given set has no elements common with other given set. 9. Write a Python program to remove additional spaces in a given list. Original list: abc.'sdfds: sdfdsthuy'1 Remove additional spaces from the said list: Tabe","", sdfds","", sdfds', huy] 10. Write a Python program that accept name of given subject and marks. Input number of subjects in first line and subject name, marks separated by a space in next line. Print subject name and marks in order of its first occurrence. Sample Output: Powered by Number of subjects: 3 Input Subject name and marks: Urdu 58 Input Subject name and marks: English 62 Input Subject name and marks: Math 68 Urdu 58 English 62 Math 68
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started