Prepare for your exams

Study with the several resources on Docsity

Earn points to download

Earn points by helping other students or get them with a premium plan

Guidelines and tips

Prepare for your exams

Study with the several resources on Docsity

Earn points to download

Earn points by helping other students or get them with a premium plan

Community

Ask the community

Ask the community for help and clear up your study doubts

University Rankings

Discover the best universities in your country according to Docsity users

Free resources

Our save-the-student-ebooks!

Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors

Python homework exercises covering various topics such as accessing tuple values, removing empty tuples, modifying list items in tuples, adding elements to sets, removing elements from sets, finding identical items in sets, counting words in a message, calculating customer payments, and reading and calculating a latex expression. The document also introduces machine learning and its relation to computational statistics and data mining.

Typology: Exams

2021/2022

1 / 2

Download Python Homework: Tuples, Lists, Sets and Machine Learning and more Exams Economics in PDF only on Docsity! Homework 5 Exercise 1. Do the exercises from 5.2 to 5.7 in the textbook. Exercise 2. a) Access value 20 from the following tuple: aTuple = ("Orange", [10, 20, 30], (5, 15, 25)). Expected output: 20 b) Remove an empty tuple(s) from a list of tuples. Sample data: [(), (), ('',), ('a', 'b'), ('a', 'b', 'c'), ('d')] . Expected output: [('',), ('a', 'b'), ('a', 'b', 'c'), 'd'] c) Modify the first item (22) of a list inside a following tuple to 222 tuple1 = (11, [22, 33], 44, 55). Expected output: tuple1 = (11, [222, 33], 44, 55) Exercise 3. a) Add a list of elements to a given set sampleSet = {"Yellow", "Orange", "Black"} sampleList = ["Blue", "Green", "Red"] Expected output: In set item order is not a concern {'Green', 'Yellow', 'Black', 'Orange', 'Red', 'Blue'} b) Remove 10, 20, 30 elements from a following set at once set1 = {10, 20, 30, 40, 50} Expected output: {40, 50} Exercise 4. ) Return a set of identical items from a given two Python set set1 = {10, 20, 30, 40, 50} set2 = {30, 40, 50, 60, 70} Expected output: a) {40, 50, 30} b) {70, 40, 10, 50, 20, 60, 30} c) {10,20} d) {10,20,60,70} Exercise 5. Let a message: Machine learning; (ML) is the study of \ computer algorithms that improve automatically through# experience. It is seen as a subset of artificial intelligence. Machine learning algorithms build a mathematical model based on sample data, known as "training data", in order to make predictions or decisions without being explicitly programmed to do so. Machine{ learning} algorithms are used in a wide variety of applications, such as email filtering and computer() vision, where it is difficult or infeasible to develop conventional algorithms to perform the needed tasks. Machine# learning is closely related to computational *statistics, which focuses on making predictions! using computers. The study of mathematical optimization delivers methods, theory and application domains to the-- field ;of machine learning. Data mining is a related field of study, focusing on