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')
from 2020-2021.
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
from 2020-2021.
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
from 2020-2021.
lotr_set = set()
lotr_set.add('Bilbo')
# current state {'Bilbo'}
lotr_set.add('Frodo')
# current state {'Bilbo', 'Frodo'}
lotr_set.add('Sam')
# current state {'Sam', 'Frodo', 'Bilbo'}
lotr_set.add('Pippin')
# current state {'Sam', 'Bilbo', 'Pippin', 'Frodo'}
lotr_set.add('Merry')
print(lotr_set)
# output {'Frodo', 'Sam', 'Merry', 'Pippin', 'Bilbo'}
from 2020-2021.
fellowship_hobbits = set()
fellowship_hobbits.add("Bilbo")
fellowship_hobbits.add("Frodo")
fellowship_hobbits.add("Sam")
fellowship_hobbits.add("Pippin")
fellowship_hobbits.add("Merry")
from 2020-2021.
my_set = {'Bilbo', 'Frodo', 'Sam', 'Pippin', 'Merry'}
from 2020-2021.
my_set=set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
output=my_set
from 2020-2021.
my_set= set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Merry")
my_set.add("Pippin")
print my_set
from 2020-2021.
char_set = set()
char_set.add("Bilbo")
char_set.add("Frodo")
char_set.add("Sam")
char_set.add("Pippin")
char_set.add("Merry")
# char_set = { 'Sam', 'Bilbo', 'Frodo', 'Merry', 'Pippin'}
from 2020-2021.
# Write a code in Python to create a set of the following elements:
# "Bilbo", "Frodo", "Sam", "Pippin", "Merry".
lotr_set = set()
lotr_set.add("Bilbo")
lotr_set.add("Frodo")
lotr_set.add("Sam")
lotr_set.add("Pippin")
lotr_set.add("Merry")
print(lotr_set)
from 2020-2021.
`my_set = set ()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Mary")
print(my_set)`
from 2020-2021.
# Write a code in Python to create a set of the following elements:
# "Bilbo", "Frodo", "Sam", "Pippin", "Merry".
my_set = {"Bilbo", "Frodo", "Sam", "Pippin", "Merry"}
print(my_set)
from 2020-2021.
lotr_set={"Bilbo", "Frodo", "Sam", "Pippin", "Merry"}
from 2020-2021.
hobbit_set = set()
hobbit_set.add("Bilbo")
hobbit_set.add("Frodo")
hobbit_set.add("Sam")
hobbit_set.add("Pippin")
hobbit_set.add("Merry")
print(hobbit_set)
# output: {'Merry', 'Sam', 'Frodo', 'Bilbo', 'Pippin'}
from 2020-2021.
`
hobbit_set = set()
hobbit_set.add("Bilbo")
hobbit_set.add("Frodo")
hobbit_set.add("Sam")
hobbit_set.add("Pippin")
hobbit_set.add("Merry")
print(hobbit_set)
`
from 2020-2021.
my_lotr_set = set()
my_lotr_set.add("Bilbo")
my_lotr_set.add("Frodo")
my_lotr_set.add("Sam")
my_lotr_set.add("Pippin")
my_lotr_set.add("Merry")
print(my_lotr_set)
# Output: my_lotr_set = {"Bilbo", "Frodo", "Sam", "Pippin", "Merry"}
from 2020-2021.
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Pippin")
my_set.add("Marry")
print(my_set)
from 2020-2021.
LOTR_set = set()
LOTR_set.add("Bilbo")
LOTR_set.add("Frodo")
LOTR_set.add("Sam")
LOTR_set.add("Pippin")
LOTR_set.add("Merry")
print(LOTR_set)
from 2020-2021.
lotr_set=set()
lotr_set.add("Bilbo")
lotr_set.add("Frodo")
lotr_set.add("Sam")
lotr_set.add("Pippin")
lotr_set.add("Merry")
from 2020-2021.
my_set = {"Bilbo", "Frodo", "Sam", "Pippin", "Merry"}
print(my_set)
from 2020-2021.
Hi all,
thanks for your answer. Just a comment for @giorgiasampo: print my_set
is a Python 2 construct, while in Python 3 you should use print(my_set)
– print
is a proper function in Python 3.
from 2020-2021.
Related Issues (20)
- Lecture "Brute-force algorithms", exercise 5 HOT 15
- Lecture "Organising information: unordered structures", exercise 2 HOT 19
- Lecture "Organising information: unordered structures", exercise 3 HOT 20
- Lecture "Recursion", exercise 1 HOT 19
- Lecture "Recursion", exercise 2 HOT 20
- Lecture "Divide and conquer algorithms", exercise 1 HOT 19
- Lecture "Divide and conquer algorithms", exercise 2 HOT 17
- Lecture "Divide and conquer algorithms", exercise 3 HOT 5
- Lecture "Dynamic programming algorithms", exercise 1 HOT 21
- Lecture "Dynamic programming algorithms", exercise 2 HOT 19
- Lecture "Organising information: trees", exercise 1 HOT 9
- Lecture "Organising information: trees", exercise 2 HOT 7
- Bonus exercise (AtariGo) HOT 2
- Lecture "Backtracking algorithms", exercise 1 HOT 6
- Lecture "Backtracking algorithms", exercise 2 HOT 5
- Lecture "Organising information: graphs", exercise 1 HOT 15
- Lecture "Organising information: graphs", exercise 2 HOT 14
- Lecture "Greedy algorithms", exercise 1 HOT 5
- Lecture "Greedy algorithms", exercise 2 HOT 1
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 2020-2021.