Q
?
A -
Informatica
search
Login
Remember
Register
New Activity
Questions
Unanswered
Tags
Categories
Users
Course
News
FAQs
Do you need any help?
Ask a Question
Notice Board
Prossime date d'esame
SITUAZIONE VOTI AL 24/10/21
-- ESAME ONLINE --
TUTORAGGIO
GUIDE e FAQ
COME PARTECIPARE ALLE VIDEOLEZIONI
REGOLAMENTO DEL CORSO
SOFTWARE DA INSTALLARE
Info sul corso (libro,
diario lezioni
ecc..)
Programming AY20-21 (il nostro corso gemello in Inglese)
Eserciziario Python
WTF Python!
Python Cheatsheet
Time complexity of methods
import antigravity
FAQ
TUTTI GLI HW sono linkati qui sotto
Exams
Test
Grades
Attachments
Esame 18-6-21
check
link
Esame 12-2-21 mattina
check
link
Esame 12-2-21 pomeriggio
check
link
Esame 19-1-21 mattina
check
link
Esame 19-1-21 pomeriggio
check
link
HW8 recupero
link
HW6 recupero
link
HW4 recupero
link
HW8 obbligatorio
check
link
HW7 opzionale
link
HW6 obbligatorio
check
link
HW5 opzionale
link
HW2 recupero
link
HW4 obbligatorio
check
link
HW3 opzionale
link
HW2 obbligatorio
check
link
HW1 opzionale
link
707
questions
1.655
answers
1.988
comments
804
users
Related questions
HW8 - Items in the second set but not in the first
HW8req: "AssertionError: Items in the first set but not the second"
Confrontare un elemento su più liste contemporaneamente
Most popular tags
homework
homework4
hw6
hw4
hw8
homework6
test
python
ricorsione
homework2
homework8
prosodia
homework-di-recupero
recupero
error
esame
hw4rec
peer-assessment
voti
spyder
test-segreti
avvisi
guida
hw2
hw5opz
obbligatorio
timeout
vm
ammessi
homework6-di-recupero
hw6rec
efficienza
eserciziario
hw6req
prova-di-esame
tempi
caratteri-speciali
immagini
pa
#python
rettangoli
soluzioni
tempo
anaconda
classi
images
opzionale
periodo
pytest
results
Inserire delle liste in un set
P
Pasqualino96
(1490 points)
3
17
27
asked
Dec 16, 2020
in
HW8 obbligatorio
by
Pasqualino96
(
1,490
points)
Ragazzi, come posso inserire delle liste all'interno di un set?
117
views
4
1 Answer
Best answer
Romitoskj
(8920 points)
4
8
40
answered
Dec 16, 2020
by
Romitoskj
(
8,920
points)
selected
Dec 16, 2020
by
Pasqualino96
Non si può, sono mutabili. Nei set puoi inserire solo oggetti immutabili come interi, float, stringhe, tuple ecc.
2
comment
P
Pasqualino96
(1490 points)
3
17
27
commented
Dec 16, 2020
by
Pasqualino96
(
1,490
points)
ma quindi per l'HW8 basta inserire semplicemente le stringe e le città di destinazione finali?
twgever
(15190 points)
7
27
105
commented
Dec 16, 2020
by
twgever
(
15,190
points)
stringhe e città, ciascuna dentro una tupla, come si vede nella traccia
P
Pasqualino96
(1490 points)
3
17
27
commented
Dec 16, 2020
by
Pasqualino96
(
1,490
points)
ok, ma a questo punto come faccio ad inserire le tuple all'interno dell'insieme?
twgever
(15190 points)
7
27
105
commented
Dec 16, 2020
by
twgever
(
15,190
points)
add, +, come vuoi. Come aggiungeresti un qualsiasi elemento ad un insieme.
P
Pasqualino96
(1490 points)
3
17
27
commented
Dec 16, 2020
by
Pasqualino96
(
1,490
points)
non riesco, ti faccio capire come sto facendo:
al momento io ho una lista di liste contenente la stringa del segreto più l'ultima città di destinazione. Sto provando a scorrere con un ciclo for la lista, ritrasformo le liste al suo interno in tuple e tento di inserirle all'interno di questo set, che ho dichiarato in questo modo: " insieme = {}"
Il problema è che così me lo vede come dizionario e non insieme. Come devo fare?
andrea.sterbini
(172680 points)
511
927
1776
commented
Dec 16, 2020
by
andrea.sterbini
(
172,680
points)
{} crea un dizionario vuoto, set() un insieme vuoto
twgever
(15190 points)
7
27
105
commented
Dec 16, 2020
by
twgever
(
15,190
points)
ah, allora basta che inizializzi bene. se fai A={} , A sarà un dizionario. se fai A=set(), A sarà un set.
P
Pasqualino96
(1490 points)
3
17
27
commented
Dec 16, 2020
by
Pasqualino96
(
1,490
points)
Grazie mille
Please
log in
or
register
to add a comment.