+ 2
Why my code isnt appending list with uppercase letters?
9 odpowiedzi
0
if u mean like this
s = len(x)
while c < s:
u can do that
+ 1
Thanks for your suggestion now i have solved the problem
+ 1
You can use list comprehension and just append it to itself
x = ['ab','bc','cd','de']
x += [i.upper() for i in x]
print(x)
Basically the same as:
x = ['ab','bc','cd','de']
y = []
for i in x:
y.append(i.upper())
x += y
print(x)
+ 1
Thanks BroFar
+ 1
Welcome Albert
0
that code probably would run forever
u append it to the original list, and that while loop's condition will never turn false
u can create another list to hold that new uppercast words
0
What if i will assign len to another variable before using while loop ?
0
Hi there