The Artima Developer Community
Sponsored Link

Java Answers Forum
pls help me with my HW

3 replies on 1 page. Most recent reply: Nov 16, 2005 12:42 AM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
josef Klíma

Posts: 1
Nickname: pepa
Registered: Nov, 2005

pls help me with my HW Posted: Nov 13, 2005 3:47 PM
Reply to this message Reply
Advertisement
Hey!
Am in a very big trouble. At 1st am sorry for my english. I do many mistakes:-( Sorry. Is here some1 who could help me,pls? The programm should work on a basic of "fields". My homework is to create a programm which would work like this:
1)one put some numbers into the programm - doesnt matter how many numbers eg. 1,2,8,7,4,6,2,1,0,5,4,4,1,1,0,9,8
2)the programm should write: a)how many is single of the numbers
b)what number is the most often
If u can, pls send me the code into my email pepaklima2@seznam.cz Thank u in advance!


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: pls help me with my HW Posted: Nov 14, 2005 7:27 AM
Reply to this message Reply
We certainly don't do your homework for you, but we are willing to help.

Wich are the problems you have?

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: pls help me with my HW Posted: Nov 16, 2005 12:40 AM
Reply to this message Reply
Really, you should do your own homework, but just this once:

stuff={}
for num in raw_input('Lay some numbers on me! ').split():
stuff[num] = stuff.get(num,0)+1
pairs = zip( stuff.values(), stuff.keys() )
if pairs:
pairs.sort()
if pairs[0][0] == 1:
print 'Singletons:',
for c,n in pairs:
if c > 1: break
print n,
print
else:
print 'No singletons.'
print 'At %d occurrances, %s was most popular.' % pairs[-1]
else:
print 'Well what the heck do you expect?'


And a little help with your English as a bonus: We have these things called "vowels" that we put into words like "please" to make them sound more sincere. Typing in full words gives people the impression that you are really not so lazy -- then they won't even notice that you are asking them to do your howework for them without even trying to write a single line of code yourself.

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: pls help me with my HW Posted: Nov 16, 2005 12:42 AM
Reply to this message Reply
(oops, "for you" not "for them" -- we need the ability to edit posts!)

Flat View: This topic has 3 replies on 1 page
Topic: Java.io Previous Topic   Next Topic Topic: A question about EJB 2.1 timeouts

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use