• Cours
  • Compilateur de code
  • Discuter
  • Tarification
  • Équipes
Menu

Discussions Q&R

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
pythonstrings
1 Vote
3 Réponses
16th Oct 2016, 10:28 PM
питер огнекрылый
питер огнекрылый - avatar
in 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??
c++loops
2 Votes
3 Réponses
12th Jan 2017, 4:40 AM
Pragya Priya
Pragya Priya - avatar
< Précédent1...1718Suivant >
Aujourd'hui en vedette
how does this code function?
2 Votes
.
1 Votes
What?
0 Votes
HTML
0 Votes
Web
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
AI
2 Votes
help
0 Votes
APIs
1 Votes