Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python elementary problem
#3
What does it mean to be a "separated number". Most of the separators will be spaces. Do you have any instructions on what to do about punctuation? Is "2020" a separated number in 'The sign is supposed to say "2020"'? Is '2020.' a separated number in 'This year is 2020.'? Do you need to find float numbers? Is 123.456 a separated number? Two separated numbers? Not separated?

And then think about how you will search. You could break your text up into "separated" things and find which of those are numbers, you you could search the text for any digit and then check if the digit is part of a separated number.

I would not be thinking about using "isdigit" at all and I would certainly not be thinking about it or any other python code until I had firmed up the logic of how I would solve the problem. If you cannot solve the problem using pencil and paper and a well defined set of instructions you cannot write a program.
ndc85430 likes this post
Reply


Messages In This Thread
Python elementary problem - by saratha - Nov-04-2020, 04:22 PM
RE: Python elementary problem - by Axel_Erfurt - Nov-04-2020, 04:24 PM
RE: Python elementary problem - by saratha - Nov-04-2020, 05:27 PM
RE: Python elementary problem - by deanhystad - Nov-04-2020, 05:07 PM
RE: Python elementary problem - by jefsummers - Nov-04-2020, 07:03 PM
RE: Python elementary problem - by Axel_Erfurt - Nov-04-2020, 07:28 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020