Python Forum
Hey guys, help a newbie out with a list problem.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hey guys, help a newbie out with a list problem.
#1
Hey all,

As the title suggests, I'm quite new to python and programming in general,(although I have some basic understanding and have played a bit with programming before), I have a problem I am trying to solve, hopefully someone can help me out.

I have a list, the list if composed of numbers ranging from 1 to 10 in length. The first 6 digits are prefixes and repeat roughly 350 times the number after the prefix is random. The list is not ordered by the prefix, it is random. I am trying to renumber the list so that any numbers with the same prefix are sequenced, without reordering the list.

To visualize it it works something like this.

current list:
AAAAA.1
CCCCC.50
AAAAA.498
CCCCC.12
BBBBB.9
BBBBB.1954


Desired list:
AAAAA.1
CCCCC.1
AAAAA.2
CCCCC.2
BBBBB.1
BBBBB.2

Any help would be greatly appreciated.

Thanks,
S
Reply
#2
Please show what you have tried so far, or at least how you envision that this could be done.
We are gladto help you solve the problem, but won't do it for you.
Reply
#3
(Feb-15-2018, 05:06 PM)Larz60+ Wrote: Please show what you have tried so far, or at least how you envision that this could be done. We are gladto help you solve the problem, but won't do it for you.

Arghh I wrote a reply then hit the back button and lost it!!!!

Thanks Larz for the reply, I'll try it again in the morning, or if I have the energy, when I get home.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with "Number List" problem on HackerRank Pnerd 5 2,034 Apr-12-2022, 12:25 AM
Last Post: Pnerd
  Newbie first problem cima_hurdle 8 3,344 Feb-09-2022, 10:02 PM
Last Post: cima_hurdle
  guys please help me , pycharm is not able to identify my xlsx file CrazyGreenYT7 1 1,971 Jun-13-2021, 02:22 PM
Last Post: Larz60+
  hi guys, i'm back to learning python ! astral_travel 6 2,857 Oct-05-2020, 10:02 AM
Last Post: astral_travel
  Hi Guys, please help me to write SAS macro parameter equivalent code in Python Manohar9589 2 2,538 Jun-14-2020, 05:07 PM
Last Post: Larz60+
  Could you guys help with this bug. I would post on StackOverflow but I got tempbanned ryder5227 2 2,326 Sep-26-2019, 08:01 PM
Last Post: metulburr
  Newbie Question re "TypeError: '<' not supported between instances of 'list' and 'int sr12 8 12,945 Apr-11-2019, 08:19 PM
Last Post: sr12
  Help Please guys AbuSiraj 2 2,642 Feb-14-2019, 09:29 AM
Last Post: AbuSiraj
  Newbie lists problem LedDiode 5 3,590 Dec-16-2018, 08:33 PM
Last Post: LedDiode
  Newbie Ubuntu script problem Kloontor 6 3,450 Sep-24-2018, 03:51 PM
Last Post: Kloontor

Forum Jump:

User Panel Messages

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