Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lecture "Organising information: unordered structures", exercise 1 #21

Open
essepuntato opened this issue Nov 14, 2022 · 16 comments
Open
Labels

Comments

@essepuntato
Copy link
Contributor

Write a code in Python to create a set of the following elements: "​Bilbo"​, "​Frodo"​, "​Sam"​, "​Pippin"​, "​Merry"​.

@n1kg0r
Copy link

n1kg0r commented Nov 14, 2022

lotr_set = {"Bilbo", "Frodo", "Sam", "Pippin", "Merry"} 

@lvcasmariani
Copy link

lotr_set_friends = set ()
lotr_set_friends.add("Bilbo")
lotr_set_friends.add("Frodo")
lotr_set_friends.add("Sam")
lotr_set_friends.add("Pippin")
lotr_set_friends.add("Merry")

print(lotr_set_friends)

@delete4ever
Copy link

my_set= {"Bilbo","Frodo","Sam","Pippin","Merry"}

@EricaAndreose
Copy link

fellowship = set()
fellowship.add("Bilbo")
fellowship.add("Frodo")
fellowship.add("Sam")
fellowship.add("Pippin")
fellowship.add("Merry")

print(fellowship)

# Terminal run:
{'Merry', 'Sam', 'Frodo', 'Bilbo', 'Pippin'}

@GaiaOrtona
Copy link

my_first_set = {"Bilbo", "Frodo", "Sam", "Pippin", "Merry"} #otherwise you can also do it this way my_second_set = set() my_second_set.add("Bilbo") my_second_set.add("Frodo") my_second_set.add("Sam") my_second_set.add("Pippin") my_second_set.add("Merry") print(my_second_set)

@giorgiacrosilla
Copy link

my_set = {"Bilbo", "Frodo", "Sam", "Pippin", "Merry"}
print(my_set)

@mjavadf
Copy link

mjavadf commented Nov 15, 2022

fellowship = {"Bilbo",
              "Frodo",
              "Sam",
              "Pippin",
              "Merry"}

@tiglio95
Copy link

...
elements = set()
elements.add("Bilbo")
elements.add("Frodo")
elements.add("Sam")
elements.add("Pippin")
elements.add("Merry")
print(elements)
...

@lucia1299
Copy link

my_set = {"​Bilbo", "​Frodo", "​Sam", "​Pippin", "​Merry"}

@ranacoskun
Copy link

my_set = set(("Bilbo","Frodo","Sam","Merry","Pippin"))

@matteo-guenci
Copy link

hobbits = {"​Bilbo"​, "​Frodo"​, "​Sam"​, "​Pippin"​, "​Merry"}

@corrado877
Copy link

my_first_set= set()
my_first_set.add ("Bilbo")
my_first_set.add ("Frodo")
my_first_set.add ("Sam")
my_first_set.add ("Pippin")
my_first_set.add ("Merry")
print (my_first_set)
my_first_set={"Sam","Bilbo", "Pippin", "Frodo", "Merry"}

@SalvatoreDiMarzo
Copy link

my_lotr_set = { "​Bilbo"​, "​Frodo"​, "​Sam"​, "​Pippin"​, "​Merry"}

@ChiaraParravicini
Copy link

hobbits_set  = {"Bilbo", "Frodo", "Sam", "Pippin", "Merry"}

@eugeniavd
Copy link

my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Pippin")
my_set.add("Merry")

#checking
print(my_set)

{'Bilbo', 'Pippin', 'Merry', 'Frodo'}

@alka2696
Copy link

new_set = set()
new_set.add("Bilbo")
new_set.add("Frodo")
new_set.add("Sam")
new_set.add("Pippin")
new_set.add("Merry")

print(new_set)

Output- {'Bilbo', 'Merry', 'Sam', 'Pippin', 'Frodo'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests