Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grátisQ&A Discussões
nums
0 Voto
1 RespostaImport random
0 Voto
16 RespostasWhy this code runs?:
nums = [4, 5, 6]
msg = "Numbers: {} {}". format(nums[0], nums[1], nums[2])
print(msg)
Numbers:4, 5.
Byt the code:
nums = [4, 5, 6]
msg = "Numbers: {} {} {} {}". format(nums[0], nums[1], nums[2])
print(msg)
leading to error?
IndexError: tuple index our of range
1 Voto
3 RespostasI dont unserstand the output if this code :
# string formatting
nums = [4, 5, 6]
msg = "Numbers: {0} {0} {2}". format(nums[0], nums[1], nums[2])
print(msg)
4 4 6
but when I do :
# string formatting
nums = [4, 5, 6]
msg = "Numbers: {0} {0} {2}". format(nums[1], nums[1], nums[2])
print(msg)
it gives me
5 5 6
is there a priority in the Reading ?
0 Voto
5 RespostasQuente hoje
Image doesn't load on html
1 Votes
HTML CSS - Filter: brightness()
0 Votes
Error
0 Votes
Need help pls
1 Votes
Remove from a slice of a list
1 Votes
python courses
0 Votes
Why it's giving error
1 Votes