Why this code is an error?(¿Por qué este código es un error?): | Sololearn: Learn to code for FREE!

+5

Why this code is an error?(¿Por qué este código es un error?):

https://code.sololearn.com/c1qINhs1rgAQ/?ref=app

12/4/2021 3:01:24 AM

★«Caleb Guerra Ortega»★

18 Answers

New Answer

+2

I think this is the best way I can make it https://code.sololearn.com/cKUrJu0eYkTr/?ref=app

+5

Mafdi, that's the solution of my problem, I was think in that, thank you. By the way, thanks to all(꧁Ankit, Kode Krasher and Elon Yemp #RELOADED#

+4

★«Caleb Guerra Ortega»★ Your anwer https://code.sololearn.com/cFTQ57KsQqf2/?ref=app

+3

꧁Ankit Chatterjee[LESS ACTIVE THAN EVER]꧂ I want to print the number of the for loop is the sum of all numbers is 14.

+3

Because you are giving a list of strings to the sum function.

+3

꧁Ankit Chatterjee[LESS ACTIVE THAN EVER]꧂ do you think in list comprehension or are you just showing off?! Nice Code BTW! 😎👍

+3

Kode Krasher what will I do by show off get followers 😏! after 1 month I will leave sololearn btw, there's no need of show off

+3

Kode Krasher i just posted his answer, I guessed what he wanted to do. And Thanks for praising my code. 😐

+3

Kode Krasher you are right I am aren't an beginner in python. I just don't complete courses for I come here to code and meet my dear friends, I have Completed python, java , web., lol Happy Coding! 😎👍 I don't like gifts take this return gift 📦 😎👍

+3

꧁Ankit Chatterjee[LESS ACTIVE THAN EVER]꧂ I sorry, but I can't modify the range of the code.

+2

What do you want to do in the code??

+2

Mafdi is Right. You are giving a list of chars and not a list of digits. Convert the chars in digits Do sum([int(d) for d in list(str(number))])

+2

Jamil Waheeb Hello

+1

★«Caleb Guerra Ortega»★ Do you understand the error? ask yourself a few of questions: 1. what data type is your variable "number" 2. why would you cast it to a string to do a calculation? 3. where is your list? I don't have time to dig any further. But I think those items are obvious enough that it might help you rewrite your code so it works? Happy Coding! 😎👍

+1

★«Caleb Guerra Ortega»★ I might look at this in the morning (no promises)... just for clarity: You want to know the number that your for loop generates that when split sums to 14? example: 100706 = [1,0,0,7,0,6] = 14 Sounds like a fun problem for python?! post your solution if you find it before I get to it. 😉 Happy Coding! 😎👍

+1

꧁Ankit Chatterjee[LESS ACTIVE THAN EVER]꧂ something told me you weren't a beginner at python? lol Happy Coding! 😎👍

+1

★«Caleb Guerra Ortega»★ Welcome!

0