[Tutor] can any one help

invincible patriot invincible_patriot at hotmail.com
Sun Jan 31 22:27:26 CET 2010


thanks for the reply
i did one question
i will tel u my progress in another question n then u tel me that what next must be done

thanks
Write a small Python program that generates the list of all pairs of characters c and
its doubling 2  c, where c moves through all the letters of the string "foobar" and prints it out.
The result will look like:
[(’f’, ’ff’), (’o’, ’oo’), (’o’, ’oo’), (’b’, ’bb’), (’a’, ’aa’), (’r’, ’rr’)]

thatz the question
i think that first i woulf take a string 'foobar'
convert it into a list
take itz length
n then do indexing
and then multiply using for loop

herez my code

a='foobar'
b=list(a)
print b
['f','o','o','b','a','r']

c=len(b)
6


thatz where i am
now i wana do the indexing of each character so that i use for loop n multply each character with 2


waiting for ur reply


> Date: Sun, 31 Jan 2010 11:01:19 -0500
> From: amonroe at columbus.rr.com
> To: tutor at python.org
> Subject: Re: [Tutor] can any one help
> 
> 
> > 1 1.1 Write a Python program with a loop that prints out a sequence
> > of numbers as follows:15 13 11...3 1 -1
> 
> Hint 1: Learn about FOR loops.
> 
> Hint 2: Learn about the RANGE command.
> 
> Hint 3: Show us some code you have written. Even if yours doesn't
> work, we can probably spot WHY it doesn't work.
> 
> Alan
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/196390707/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100131/3ddd9809/attachment.htm>


More information about the Tutor mailing list