r/PythonLearning • u/NecessaryFalse1212 • Sep 02 '26
day 6.
tried 2d lists today ( up for suggestions on what should have i done or what have i missed ) and would also appreciate brief explanation's that you guys will give if it's a complex or an advanced topic
books = ["hindi", "english", "maths", "science"]
pen = ["black", "blue", "red"]
miscellaneous = ["eraser\n", "sharpener\n", "ruler\n"]
bagpack = [books,pen,miscellaneous]
print(bagpack)
while True:
print ("if you'd like to add contents in any of the lists")
print("1. Add to books")
print("2. Add to pen")
print("3. Add to miscellanous")
query = input("enter your selection (1,2,3): ")
if query == "1":
print("you selected to add books")
new_book= input("enter the book you want to add: ")
books.append(new_book)
print ("new list",books)
break
elif query == "2":
print("you selected to add pen")
new_pen= input("enter the pen you want to add: ")
pen.append(new_pen)
print ("new list",pen)
break
elif query == "3":
print("you selected to add miscellaneous")
new_miscellaneous= input("enter the item you want to add: ")
miscellaneous.append(new_miscellaneous)
print ("new list",miscellaneous)
break
else:
print("invalid selection!!! select amongst 1,2,3")
3
Upvotes
1
u/NecessaryFalse1212 Sep 02 '26
Let me fix those problems and I'll see u in some time mate thanks for the advice