http://www.practicepython.org/exercise/2014/03/12/06-string-lists.html

Here is my answers.  What would make it better?

import random
str1=""
letcount=4
count=0
abc='abcdefghijklmnopqrstuvwxyz'
while True:
    for i in range(letcount):
        a=random.choice(abc)
        str1+=a
    print str1
    count+=1
    if str1==str1[::-1]:        
        break
    else:
        str1=""
print "Tries= ",count
print str1
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to