Comments (21)
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
print(my_set)
from 2018-2019.
my_set = set() # this creates a new set
my_set.add("Bilbo") # these 5 lines add five names
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
print(my_set)
from 2018-2019.
hobbits = set() #create an empty set and associate it to "hobbits" variable
hobbits.add("Bilbo") #add a new element to the set
hobbits.add("Frodo") #etc.
hobbits.add("Sam")
hobbits.add("Pippin")
hobbits.add("Merry")
from 2018-2019.
Write a pseudocode in Python so as to create a set of the following elements: "Bilbo", "Frodo", "Sam", "Pippin", "Merry".
set_tolkien= ()
set_tolkien.add("Bilbo")
set_tolkien.add("Frodo")
set_tolkien.add("Sam")
set_tolkien.add("Pippin")
set_tolkien.add("Merry")
Current status of set_tolkien: ({"Bilbo", "Frodo", "Sam", "Pippin", "Merry"})
from 2018-2019.
1 | protagonists=set()
2 | protagonists.add("Bilbo")
3 | protagonists.add("Frodo")
4 | protagonists.add("Sam")
5 | protagonists.add("Pippin")
6 | protagonists.add("Merry")
7 | print (protagonists)
Final set, containing ["Bilbo", "Merry", "Sam", "Pippin","Frodo"]
from 2018-2019.
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
print(my_set)
#my_set = ({"Bilbo", "Frodo", "Sam", "Pippin", "Merry"})
from 2018-2019.
my_set = set() # create a new set
# add the elements "Bilbo", "Frodo", "Sam", "Pippin", "Merry"
# in a random order
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
print(my_set)
from 2018-2019.
hobbitset = set()
hobbitset.add("Bilbo")
hobbitset.add("Frodo")
hobbitset.add("Sam")
hobbitset.add("Pippin")
hobbitset.add("Merry")
print(hobbitset)
output = {'Sam', 'Bilbo', 'Frodo', 'Merry', 'Pippin'}
from 2018-2019.
my_name_set = set()
my_name_set.add("Bilbo")
my_name_set.add("Frodo")
my_name_set.add("Sam")
my_name_set.add("Pippin")
my_name_set.add("Merry")
my_name_set = ("Bilbo" , "Frodo" , "Sam" , " Pippin" , "Merry")
print(my_name_set)
from 2018-2019.
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
from 2018-2019.
sauron_set = set()
sauron_set.add("Bilbo")
sauron_set.add("Frodo")
sauron_set.add("Sam")
sauron_set.add("Pippin")
sauron_set.add("Merry")
from 2018-2019.
set_der_besten_hobbits = set(["Bilbo","Frodo","Sam","Pippin","Merry"])
OR
set_der_besten_hobbits = set()
set_der_besten_hobbits.add("Bilbo")
set_der_besten_hobbits.add("Frodo")
set_der_besten_hobbits.add("Sam",)
set_der_besten_hobbits.add("Pippin")
set_der_besten_hobbits.add("Merry")
from 2018-2019.
hobbitset=set()
hobbitset.add("Frodo")
hobbitset.add("Bilbo")
hobbitset.add("Sam")
hobbitset.add("Pippin")
hobbitset.add("Merry")
print(hobbitset)
from 2018-2019.
mordor_set = set() #used set() to create a new set
mordor_set.add("Bilbo") #added new element to the set
mordor_set.add("Frodo") #added new element to the set
mordor_set.add("Sam") #added new element to the set
mordor_set.add("Pippin") #added new element to the set
mordor_set.add("Merry") #added new element to the set
print(mordor_set)
#{'Frodo', 'Pippin', 'Merry', 'Bilbo', 'Sam'}
from 2018-2019.
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
print(my_set)
#my_set: {'Pippin', 'Sam', 'Frodo', 'Bilbo', 'Merry'}
from 2018-2019.
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Pippin")
my_set.add("Merry")
print (my_set)
from 2018-2019.
my_set = set()
my_set.add("Bilbo)
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
print(my_set)
Output: my_set {"Pippin", "Sam", "Frodo", "Bilbo", "Merry"}
from 2018-2019.
my_hobbits = set()
my_hobbits.add("Bilbo")
my_hobbits.add("Frodo")
my_hobbits.add("Sam")
my_hobbits.add("Pippin")
my_hobbits.add("Merry")
print(my_hobbits)
from 2018-2019.
from 2018-2019.
from 2018-2019.
the_hobbits = set() # this creates a new set
# adding elements to the set without any particular order
the_hobbits.add("Bilbo")
the_hobbits.add("Frodo")
the_hobbits.add("Sam")
the_hobbits.add("Pippin")
the_hobbits.add("Merry")
print(the_hobbits)
Output: the_hobbits{'Sam', 'Frodo', 'Bilbo', 'Merry', 'Pippin'}
from 2018-2019.
Related Issues (20)
- Lecture "Brute-force algorithms", exercise 3 HOT 13
- Lecture "Brute-force algorithms", exercise 4 HOT 16
- Lecture "Brute-force algorithms", exercise 5 HOT 12
- Lecture "Organising information: unordered structures", exercise 2 HOT 19
- Lecture "Organising information: unordered structures", exercise 3 HOT 17
- Lecture "Recursion", exercise 1 HOT 18
- Lecture "Recursion", exercise 2 HOT 20
- Lecture "Divide and conquer algorithm", exercise 1 HOT 12
- Lecture "Divide and conquer algorithm", exercise 2 HOT 5
- Lecture "Dynamic programming algorithms", exercise 1 HOT 15
- Lecture "Dynamic programming algorithms", exercise 2 HOT 8
- Lecture "Organising information: trees", exercise 1 HOT 4
- Lecture "Organising information: trees", exercise 2 HOT 4
- Lecture "Organising information: graphs", exercise 1 HOT 14
- Lecture "Organising information: graphs", exercise 2 HOT 12
- Christmas present game + bonus Python exercise
- Lecture "Backtracking algorithms", exercise 1 HOT 3
- Lecture "Greedy algorithms", exercise 1 HOT 2
- Question about an exercise from last year
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 2018-2019.