a. Generate a list of 10,000 strings that cycles through the lower case alphabet in a way similar to Excel’s column naming convention. For example, the sequence should look like: a,b,c,…,z, aa,ab,ac,…,az,ba,bb,bc,…,bz…etc.
(Feb-09-2017, 09:26 PM)micseydel Wrote: [ -> ]What have you tried?
we are trying to use for and while loops when generating a list. But I don't have idea how to do it.
(Feb-12-2017, 10:17 PM)Larz60+ Wrote: [ -> ]Please show your code
list1 = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
while list1 > list1[25]:
print list2 = ['a' + v for v in list1]
list2
while list2 > list2[25]:
list3 = ['b' + v for v in list1]
list3
THIS GIVE US ERROR
this is what we have so far. we are new using python and were given with this assignment. thank you for replying
Please use code or python tags. Please don't use formatting tags, especially in your code. And in the future, if you get an error, show us the full error so we know what it is.
You can't do an assignment in a print statement. You need to assign the value in one statement, then print it in another.
I don't understand you're while conditions at all. What are you expecting to get comparing the whole list to the last item in the list?
You want to loop until your list is 10,000 items long, and each loop you want to with the next item or items in that list.
(Feb-12-2017, 10:26 PM)lizarragaman Wrote: [ -> ]THIS GIVE US ERROR
What error?
When you type
while list1 > list1[25]:
, what do you expect to happen? Because comparing a list to an element of that list is a meaningless comparison, and the best case scenario is that it is always False.