0
Help please in solving python problem. Read problem below and try to make solution code.
print the sum of the numbers in the list/array, except ignore sections of numbers starting with a 6 and extending to the next 7 (every 6 will be followed by at least one 7). print 0 for no numbers. Make solution code. The example input and output: input [1,2,2] solution is 5 input [1,2,2,6,99,99,7] solution is 5 input [1,1,6,7,2] solution is 4 input [6,7,11] solution is 11 input [2,7,6,2,6,7,2,7] solution is 18 input [2,2,6,7,7] solution is 11 input [1,6,2,6,2,7,1,6,99,99,7] sol. is 2
8 Antworten
0
then what the question ?
0
@Fachri Fadillah: Make solution code.
0
I am quite new to SoloLearn, but most programming forums frown on this type of question (asking other people to solve problems for you).
If somebody else writes the code for you, you will learn very little.
Try your hand at this, write some code, and if it doesn't work the way you expect post it here and ask for help. You will learn a lot more this way...
0
Any dedicated learner will read and will try to make it's solution rather than spaming here and there.
By the way I made my code already and then posted the question here in the wish that if I can get more shorter code or other ways of making it.
I was going to post my code too but the word limit of questions stops me.
0
Without knowing what your code is, there is no way for us to give a better one :)
The word limit is not an issue - you can use the code playground to write your code, and only post the link here...
0
My code is here (in the last line of the code one can try other list of there own and check the sum orally according to the problem. The sum by code and orally check sum will be equal.
https://code.sololearn.com/cFy1RYm6d5HN/?ref=app
If any one has different idea of solving it or have a shorter code than they can suggest here.
0
Here is my version of the code:
https://code.sololearn.com/cAh2Hxv2JjiO/#py
However, as long as your code does the job, it's good code :) . I wouldn't worry too much about how many lines of code there are - sometimes more lines is better (it makes for more readable code :) ).
0
Thanks a lot for that code :)