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

Week 10

The document concludes with a brief heading about using SciPy in practice but provides no further details on the topic.

Uploaded by

Serge B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Week 10

The document concludes with a brief heading about using SciPy in practice but provides no further details on the topic.

Uploaded by

Serge B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

What would be the output of the following code?

primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}
teens = set([13, 14, 15, 16, 17, 18, 19])
print(primes - teens)
print(primes & teens)
print(primes | teens)
print(primes ^ teens)

What would be the output of the following code?

cast = {"Cardinal Ximenez" : "Michael Palin", "Cardinal Biggles" : "Terry Jones", "Cardinal Fang" : "Terry
Gilliam"}
cast["customer"] = "John Cleese"
cast["shopkeeper"] = "Michael Palin"
print(cast["shopkeeper"])
print(cast["Cardinal Ximenez"])
print(cast["Cardinal Fang"])

Activity 2

a) You have a list of sizes which should not be change or alter. How would you prevent the list
from being changed
a. sizes = ['XS’, 'S’, 'M’, 'L’, 'XL’, 'XXL']
b) Read data from the text clothing_stock.txt , count how many of the specific sizes are in the
text file and print out the solution.

Activity 3

Write a program to create two list: one with numbers: 0,1,2,3,4,5, second: 0,1,3,5,1,0
- Change both to be a sets.
- Add numbers: 0,1,2,7 into set1.
- Print the intersection of the two sets
- Print the union of the two sets
- Print the difference between set 1 and set 2

Activity 4

Write a function counting unique numbers of letters in a string


(Example: count_unique(‘aabb’) would return 2)

SciPy in practice.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy