Posts: 3
Threads: 1
Joined: Feb 2017
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.
Posts: 2,342
Threads: 62
Joined: Sep 2016
Posts: 3
Threads: 1
Joined: Feb 2017
(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.
Posts: 12,031
Threads: 485
Joined: Sep 2016
Posts: 3
Threads: 1
Joined: Feb 2017
Feb-12-2017, 10:26 PM
(This post was last modified: Feb-12-2017, 11:59 PM by ichabod801.)
(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
Posts: 4,220
Threads: 97
Joined: Sep 2016
Feb-13-2017, 12:07 AM
(This post was last modified: Feb-13-2017, 12:08 AM by ichabod801.)
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.
Posts: 3,458
Threads: 101
Joined: Sep 2016
(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.
|