Computer Science, asked by sushobhitharsh, 5 months ago

There is a shop of Soft Toys. A shopkeeper arranges
the Items on the shelf for display. Customer asks for
any Item randomly, either by its name or by its
position number. When Customer places order,
Shopkeeper removes those Items from Shelf to sale.
Shopkeeper then rearranges the remaining Items on
the shelf such that there is no gap left between Items
(and item numbers) on the shelf.
Items are kept in blocks on the shelf rows. Blocks are
numbered from 1 to N.
Implement suitable Data Structure with Operations
to display Items in order as arranged by shopkeeper.
When customer selects any Item from display, your
code should remove it from list of Items and display
rearranged Items
Consider the following list of Soft Toys and display is
the format of shelf.
SoftToys = ["Giant-Teddy Bear", "Giraffe", "Cat",
"Mega-Bear", "Dog", "Lion", "Billy-Bear", "Besty-Bear",
"Monkey", "Bobby-Bear", "Bunny-Rabbit", "Benjamin-
Bear", "Kung-Fu-Panda", "Brown-Bear", "Pink-Bear"
"Baby-Elephant", "Blue-Fish", "Hippo", "Cute-Pig",
"Pikachu", "Doremon", "Tortoise", "Cater-Pillar",
"Candy-Doll']
Input will be a string value which is any one of the
Soft Toy name or position as displayed on the shelf at
the point of time.​

Answers

Answered by kireetiprince
0

Answer:

such a Long question I can't understand

Answered by tharunkumarmtk
4

Answer

# Wrote in Python 3 code

print("Hello Toy Store")

def RemoveWord(list, toy):

 newList = []

 for i in list:

   if(i != toy):

     newList.append(i)

 list = newList

 return newList

SoftToys = ["Giant-Teddy Bear", "Giraffe", "Cat",

"Mega-Bear", "Dog", "Lion", "Billy-Bear", "Besty-Bear",

"Monkey", "Bobby-Bear", "Bunny-Rabbit", "Benjamin-Bear",

"Kung-Fu-Panda", "Brown-Bear", "Pink-Bear"

"Baby-Elephant", "Blue-Fish", "Hippo", "Cute-Pig",

"Pikachu", "Doremon", "Tortoise", "Cater-Pillar",

"Candy-Doll"]

while True:

 if len(SoftToys) == 0:

   break

 print("Toy List:", SoftToys)

 

 toyName = input("please enter the toy name from the list:\n")

 res = any(ele in toyName for ele in SoftToys)

 if res:

   SoftToys = RemoveWord(SoftToys, toyName)

   print(toyName, "Sold")

 else:

   print(toyName, "Not found in list")

print("All Toys are sold")

Similar questions