• Курсы
  • Компилятор кода
  • Обсуждения
  • Цены
  • Teams
Menu
0

Why is the answer 4 and not 6 ?

What is the output of this code ? nums= set([1,1,2,3,3,4)] print(len(nums))

python
20th Oct 2020, 4:45 PM
Curious Ant
Curious Ant - avatar
1 ответ
+ 11
`set` object does not store duplicate values, so in this case the stored values are 1, 2, 3, 4. That's why 4 is the answer. https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2464/
20th Oct 2020, 4:49 PM
Ipang

Часто задают такие вопросы?

Учитесь эффективнее, бесплатно:

  • Введение в Python

    7.1M учащихся

  • Введение в Java

    4.7M учащихся

  • Введение в C

    1.5M учащихся

  • Введение в HTML

    7.5M учащихся

Смотреть все курсы
Актуальное сегодня
Is this realistic enough?
1 Votes
𝙵𝙸𝙽𝙳 𝚃𝙷𝙴 𝙸𝙽𝙿𝚄𝚃 𝙾𝙵 𝚃𝙷𝙴 𝙿𝚁𝙾𝙶𝚁𝙰𝙼
1 Votes
"Which is harder to master — Machine Learning or Cybersecurity? And why?"
1 Votes
"What’s the best way to combine creativity and coding? Can storytelling improve web apps?"
1 Votes
Need friends
0 Votes
MASS N NUMBER OF OBJECT DELETION FROM A CLASS
0 Votes
Can someone explain inline and block elements please
0 Votes
I am a beginner, please teach me how to use Python
0 Votes
Python
1 Votes
Can u learn multiple language at the same time, without misplacing the formats of each with the other
0 Votes