I am totally new to python. I am trying to do a dictionary concatenation from user input and print the result. I have searched the internet for all solutions, but no solutions. Please, help.
shoeCat = {1: 'Adidas', 2: 'Alexander McQueen', 3: 'Converse', 4: 'Fila', 5: 'Kids/Teens', 6: 'Men’s Kicks', 7: 'New Balance', 8: 'Nike', 9: 'OFF-White', 10: 'Puma', 11: 'Select Brands', 12: 'Slides', 13: 'Under Armour', 14: 'Women’s Kicks'}
mycat1 = input("Enter 1st category: ")
cat1 = [shoeCat[int(x)] for x in mycat1.split()]
print(cat1)
mycat2 = input("Enter 2nd Category: ")
cat2 = [shoeCat[int(x)] for x in mycat2.split()]
print(cat2)
final= cat1 + cat2
print(*final, sep = " | ")
How do i make the code to ask for infinite multiple user inputs whith the whiile true if statement.
while True:
print ('Enter Category: (Press enter to generate.)')
mycat1 = input("")
if mycat1 == '':
break
I want to achieve these:
Enter 1st category: 1
['Adidas']
Enter 2nd Category: 2
['Alexander McQueen']
Enter 3rd Category: 6
['Men’s Kicks']
Enter 4th Category: 11
['Select Brands']
Enter 2nd Category: 13
['Under Armour']
Adidas | Alexander McQueen | Men’s Kicks | Select Brands | Under Armour
Please how do i make python3 get these result for me.