im trying to print this input list in uppercase but i always become an attribute error. I tried many ways but i still can't solve it. could someone help me? Thank you and sorry for my english :))
x = [0,1,2,3,4,5,6,7,8,9]
for i in x:
x[i] = input("Enter your name")
print(x)
CodePudding user response:
I'm not sure if I understand, but from what I do understand, I think you're looking for the .upper()
command.
In that case, it would look something like this:
x = [0,1,2,3,4,5,6,7,8,9]
for i in x:
x[i] = input("Enter your name")
print(x.upper())
And that should do the trick.
CodePudding user response:
I'm not sure why you are creating an array with defined values (all integers), but immediately replace it with an input string.
Just do:
x = list()
for i in range(0, 10):
input_name = input("Enter your name")
x[i] = input_name.upper()