₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,000 members, 8,419,872 topics. Date: Thursday, 04 June 2026 at 05:30 AM

Toggle theme

Young02's Posts

Nairaland ForumYoung02's ProfileYoung02's Posts

1 (of 1 pages)

ProgrammingRe: Coding Challenge For Fun by young02(m): 5:49pm On Oct 15, 2017
efosky1246:
Bro this might work but it's quite inefficient.why looping thrice...
quite inefficient... see as u talk am self...
No be for FUN? tsk...

If point-and-kill is what u prefer, have it!

def counter(word):
word = list(word.lower())
for i in word:
if (i.isalpha()) or (i.isdigit()):
count = word.count(i)
if (count > 1):
print "{} ={}" %(i,count)
while(word.count(i) > 1):
word.remove(i)

that's all....
code attached...
ProgrammingRe: Coding Challenge For Fun by young02(m): 8:36am On Oct 14, 2017
solution in Python(2)
<code>
def counter(word):
numberList = [] # empty list for numbers
alphaList = [] # empty list for alphabets

#sorting num and alpha from word into resp. list
for ch in word:
if ch.isdigit():
numberList.append(ch)
elif ch.isalpha():
alphaList.append(ch.lower()) #converting to lower case since matching is case-INsensitive

#counting and print only num/alpha occurring more than once
for x in numberList:
count = numberList.count(x)
if count >1:
print "{} --> {} ".format(x,count)
while numberList.count(x) > 1 : #weeding tested num
numberList.remove(x)

for i in alphaList:
count = alphaList.count(i)and
if count > 1:
print" {} --> {}".format(i, count)
while alphaList.count(i) > 1: #weeding tested alpha
alphaList.remove(i)
</code>

call function with your string as argument e.g
counter("pEpper62532622"wink)
That's all... can download attachment or visit link below if code is not well formatted...

https://gist.github.com/nny326/93d34e5d63b023d17aa5fa4534a9fb4a#file-duplicatecounter-py
Technology MarketRe: Hp CQ56 Motherboard For Sale In Ph by young02(m): 4:24am On Sep 07, 2016
swiz2:
Fully functional cq56 motherboard for sale in ph. Call or whatsapp 08034330080
How much?
Technology MarketRe: Brand New Laptop Motherboard For Sale At Reduced Price by young02(m): 9:50pm On Sep 06, 2016
ruphytelecom:
Hp CQ56 motherboard is available call 08124461809
Still available? If yes, how much?

1 (of 1 pages)