+ 3
SatyaPrakash Mishra , > to get the input data properly checked, we need to split the input sentence at each space position to a list of words. this can be done by using spit() with the input string. the result is a list of words. > next step is to iterate over the words list by using a loop, and check each item if it is defined. we also need a variable that can hold the snack points sum. > accumulate the snack points in the mentioned variable. > finaly check the value of the snack points and decide what output has to be given.
4th Aug 2024, 6:38 PM
Lothar
Lothar - avatar
+ 5
If there are 2 carrots in the input, your code will only add 9 instead of 18.
4th Aug 2024, 4:57 PM
Lisa
Lisa - avatar
4th Aug 2024, 6:25 PM
Chris Coder
Chris Coder - avatar
+ 3
Enock Dwamena Create your own post and describe your doubt and you will be helped.
5th Aug 2024, 4:22 PM
Chris Coder
Chris Coder - avatar