x = (int(input("How many items do you want in your list? ")))
items = []
for i in range(1, x + 1):
items.append(input("Enter string " + str(i) + ":"))
print(items)
If you put 2 and apple and banana, it says ["apple", "banana"]
Also, you want to find the length of the string here.
The length of the string ‘apple’ is: 5 The length of the string ‘banana’ is: 6 Total length of the strings is: 11
What should I do to express it as?
python
Use len () you can.
© 2024 OneMinuteCode. All rights reserved.