Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobierenF&A Diskussionen
Why 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 Stimme
3 Antwortenin order to find the sum of n numbers given by user,suppose our program is to find the sum of any 4 numbers given by user (using while loop such that (while(i<=4))and incrementing each value of i by 1),if the user give any 2 inputs instead of four then the total sum should be the summation of that two inputs..but the program shows the sum something else,why it is so??
2 Stimmen
3 AntwortenHeute heiß
Comparing code coach solutions
3 Votes
Automatation python
1 Votes
General python
0 Votes
view challenge analytics
2 Votes
Where to use
0 Votes
Coding path
0 Votes
Problem with application
0 Votes