control structure

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2008
Posts: 2
Reputation: pong pong is an unknown quantity at this point 
Solved Threads: 0
pong pong pong pong is offline Offline
Newbie Poster

control structure

 
0
  #1
Apr 15th, 2009
hi
I want to write this code in do while or if else, or any other way except for loop. here is the code
  1. for i in range(65,90):
  2. for j in range(65,90):
  3. for k in range(65,90):
  4. token=chr(i)+chr(j)+chr(k)
  5. block = ((i<<16)+(j<<8)+(k))
  6. cblock = pow(block,e,n)
  7. table[token]=cblock
can anyone please help me to write this in anyother format?
thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,054
Reputation: jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough 
Solved Threads: 265
Sponsor
jlm699's Avatar
jlm699 jlm699 is offline Offline
Knows where his Towel is

Re: control structure

 
0
  #2
Apr 15th, 2009
Originally Posted by pong pong View Post
hi
I want to write this code in do while or if else, or any other way except for loop. here is the code
  1. for i in range(65,90):
  2. for j in range(65,90):
  3. for k in range(65,90):
  4. token=chr(i)+chr(j)+chr(k)
  5. block = ((i<<16)+(j<<8)+(k))
  6. cblock = pow(block,e,n)
  7. table[token]=cblock
can anyone please help me to write this in anyother format?
thanks
Why are you looking to get away from the for loop? I believe that is the easiest and most straight forward way to do this....

Note: range(65,90) will only give you letters A through Y. You're missing out on the 'Z'; although perhaps that's what you had intended...
1. Use Code Tags.
2. Homework? Show Effort.
3. Keep discussions on the forum: no PMs
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 396
Reputation: leegeorg07 is an unknown quantity at this point 
Solved Threads: 31
leegeorg07's Avatar
leegeorg07 leegeorg07 is offline Offline
Posting Whiz

Re: control structure

 
0
  #3
Apr 16th, 2009
i think they just want to see if there is any other way to do it, i like to do this every so often to try different things.
don't judge me because I'm a year 8!

'it is better to fight for something than to live for nothing'General George S Patton
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC