Python Forum
Need help with checkio problem - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Need help with checkio problem (/thread-28495.html)



Need help with checkio problem - saratha - Jul-21-2020

Ok, so the problem is to solve this question...Can anyone help ?

In a given text you need to sum the numbers. Only separated numbers should be counted. If a number is part of a word it shouldn't be counted.

The text consists from numbers, spaces and English letters

Input: A string.

Output: An int.

Help please!


RE: Need help with checkio problem - buran - Jul-21-2020

what have you tried?


RE: Need help with checkio problem - Marbelous - Jul-22-2020

You need to provide a sample of the input text you need to analyze and at least show some effort on your part at coming up with a solution. HINT: Python has a built-in function called split() that will break strings apart when there's a space between words and return a list. There is also a function called isnumeric() which I'm sure will be useful to you.


RE: Need help with checkio problem - deanhystad - Jul-22-2020

Break the problem into parts. The problem says you need to sum numbers that appear in text. It says only separated numbers should be counted.

1. What does "separated numbers" mean?
2. How can you find the separated numbers?
3. How can you compute the sum of the separated numbers?

Solve 1 first. That should be easy and it affects how you will approach the solution for part 2. Part 2 must be competed before you perform part 3.

So what is your answer to part 1?


RE: Need help with checkio problem - saratha - Nov-04-2020

(Jul-22-2020, 06:03 PM)deanhystad Wrote: Break the problem into parts. The problem says you need to sum numbers that appear in text. It says only separated numbers should be counted.

1. What does "separated numbers" mean?
2. How can you find the separated numbers?
3. How can you compute the sum of the separated numbers?

Solve 1 first. That should be easy and it affects how you will approach the solution for part 2. Part 2 must be competed before you perform part 3.

So what is your answer to part 1?
thanks. I think we need to split the string and if the string is a number, then return result . Else not.


RE: Need help with checkio problem - deanhystad - Nov-04-2020

Code. Where is the code?

And wasn't this a homework question posted back in July? Isn't it a bit late now?


RE: Need help with checkio problem - Multicast - Mar-02-2021

(Jul-22-2020, 03:59 PM)Marbelous Wrote: You need to provide a sample of the input text you need to analyze and at least show some effort on your part at coming up with a solution. HINT: Python has a built-in function called split() that will break strings apart when there's a space between words and return a list. There is also a function called isnumeric() which I'm sure will be useful to you.

Thanks for the isnumeric() hint!!