Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Toys_sell_and replace_position #265

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Create Toys_sell_and replace_position
  • Loading branch information
aditya05-02 authored Oct 31, 2020
commit ed2c3dc6677366071fe3a5a4bba4df092c412bbe
26 changes: 26 additions & 0 deletions Toys_sell_and replace_position
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
l=[]
toys=["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-ELEPHATN"
,"BLUE-FISH","HIPPO","CUTE-PIG","PIKACHU","DOREMON","TORTOISE",
"CATER-PILLAR","CANDY-DOLL"]
N=input()
if N.isdigit()== True:
if(int(N)<1 or int(N)> len(toys)):
print('ITEM UNAVAILABLE')
else:
c=int(N)
del toys[c-1]
for i in toys:
k=str(toys.index(i)+1)+'.'+ i
l.append(k)
print(k, end=' ')
elif N.isalpha()==True:
if(N not in toys):
print('ITEM UNAVAILABLE')
else:
toys.remove(N)
for i in toys:
k=str(toys.index(i)+1)+'.'+ i
l.append(k)
print(k, end='')