Closed jeethub26230 closed 4 years ago
list_fruits=["apple","mango","pineapple","cherry","strawberry","orange"]
b=input("Enter fruit name:\n")
a=input("To Buy enter 2 to Sell enter 1 \n")
if(a==str(1)):
if (b in list_fruits):
list_fruits.remove(b)
print("Item Bought")
print(list_fruits)
else:
print("Item not there in list")
elif(a==str(2)):
if(b in list_fruits):
print("Item already exist")
print(list_fruits)
else:
list_fruits.append(b)
print("Item added to the list")
print(list_fruits)
else:
print("Invalid Operation Input")
cart = ['Mango', 'Apple', 'Peach', 'Banana']
a = input("what you want to do buy or sell: ")
print('Currently in cart : ')
print(cart)
if a == 'buy':
buy = input('enter then name of the fruit: ')
cart.remove(buy)
print('Cart :')
print(cart)
else:
add = input('Enter the item you want to sell:')
cart.append(add)
print('Cart :')
print(cart)
l=["Pen","Pencil","Eraser","Sharpner","Book","Notebook"]
print(l)
print('select an option:')
print('1.Purchase')
print('2.Sell')
a=int(input('Enter your option'))
if(a==1):
b=str(input('Enter name:'))
l.append(b)
print(l)
elif(a==2):
c=str(input('Enter name:'))
l.remove(c)
print(l)
else:
print('Enter a valid choice')
list_mobile=["moto","lenovo","apple","asus","realme","redmi"] b=input("Enter Mobile name:\n") a=input("To buy press 2 to sell press 1 \n") if(a==str(1)): for i in list_mobile: if (i==b): list_mobiles.remove(b) print("item brought") print(list_mobile) break else: print("item was not in the list") break elif(a==str(2)): for i in list_mobile: if (i==b): print("item was already there") print(list_mobile) break else: list_mobile.append(b) print("items added to the list") print(list_mobile) break else: print("not a valid input")
List_fruits=["apple","orange","banana","guava","cherry","mango"] Print("fruits") Print("select an option:fruit") Print("to buy enter :1") Print("to sell enter:2") a=int (input("enter option")) If(a==1) b=str (input("enter fruit name")) fruit.append(b) Print("fruit") elif (a==2) C=str (input ("enter fruit name")) fruit.remove(c) Print("fruit") else Print ("enter a invalid choice")
list=['apple','banana','orange','mango','cherry','grapes'] i=int(input("select \n 1.buy \n 2.sell")) if(i==1): a1=input("enter the fruit name") list.append(a1) print("fruit is added!") print(list) elif(i==2): a2=input("enter the fruit name") list.remove(a2) print("fruit is removed!") print(list) else: print("enter correct option")
I am suchitra sahoo, Here is my code : f_list={"apple","orange","grapes","cherry","mango","banana"} a=input("what you want to do: sell press 1 or buy press 2") if a== '1' for i in f_list: print(i) b= input("fruit name : ") f_list.remove(b) print(f_list) elif a=='2' for i in f_list: print(i) b=input("fruit name : ") f_list.append(b) print(f_list) break else print(" invalid entry")
cart = ["Mango", "Apple", "cheery", "kiwi"] a = input("select an option:") print("1.buy") print("2.sell") print("currently in cart : \n") print(cart) if a == "buy": buy = input("enter then name of the fruit: ") cart.remove(buy) print("Cart :") print(cart) else: add = input("enter the item you want to sell:") cart.append(add) print("Cart :") print(cart) else: print("invalid option:")
items = ['Apple', 'Banana', 'Custard', 'Watermelon', 'Mango', 'Orange']
fruit = input('Enter the fruit you want to buy or sell\n Your Input : ')
op = input('Enter \'buy\' to buy and \'sell\' to sell\n Your Input : ')
if (op == 'buy'):
print('Cart now')
print(items)
items.append(fruit)
print('fruit added to cart')
print(items)
elif (op == 'sell'):
if (fruit in items):
items.remove(fruit)
print('Fruit sold')
print('Cart now.')
print(items)
else:
print('You cant sell a fruit which is not in your cart')
else:
print('Please enter a valid operation')
c_fruits=["apple","orange","grapes","papaya"] a=input("enter your choise(sell=1,buy=2):") b=input("enter the fruit name:") if a=='1': c_fruits.remove(b)` print("fruit sell") print(c_fruits)
elif a=='2': c_fruits.append(b) print("fruit buy") print(c_fruits) else: print("wrong choise")
#I am Dinesh Behera
#Prepared List For Driving
fruit_basket=["kiwi","apple","pineapple","lichi","gooseberry","orange","banana"]
print("Available items:\n")
print(fruit_basket)
fn=input("Enter the fruit you want to Buy/Sell:")
ch=input("Enter 1 to Buy.\nEnter 2 to Sell.\nEnter your Choice:")
if(ch==str(1)):
#Buying
for i in fruit_basket:
if (fn.lower() in fruit_basket): #For case insensitivity
print("Fruit already bought\nPlease sell/consume it before buying again")
print("Basket Contents are:\n",fruit_basket)
break
else:
fruit_basket.append(fn)
print("Fruit Bought Successfully")
print(fruit_basket)
break
elif(ch==str(2)):
#Selling
for i in fruit_basket:
if (fn.lower() in fruit_basket): #For case insensitivity
fruit_basket.remove(fn)
print("Fruit Sold Successfully")
print("Basket Contents are:\n",fruit_basket)
break
else:
print("Fruit not bought\nPlease buy it before attempting to sell")
break
else:
print("Invalid Choice")
fruits={"apple","orange","grapes","banana","mango"} a=input(" sell press 1 or buy press 2 ") if a== '1' for i in fruits: print(i) b= input("fruit name : ") fruits.remove(b) print(fruits) elif a=='2' for i in fruits: print(i) b=input("fruit name : ") fruit.append(b) print(fruits) else print(" invalid entry")
p_list=['orange','chiku','kiwi','apple','mango','pineapple'] p = input("Enter name of the Product :-") o = input("Please Specify with Buy/Sell :-") if(o==str("Buy" or "buy" or "BUY")): p_list.append(p) print("Item Added") print(p_list) elif(o==str("Sell" or "sell" or "SELL")): p_list.remove(p) print("Item Removed") print(p_list) else: print("Invalid Argument")
list=['apple','banana','orange','mango','cherry','grapes']
print(list)
print('Enter 1 to Buy\n Enter 2 to Sell')
ch=int(input('Enter ur choice'))
if(ch==1):
b=input("enter the fruit to be bought")
list.append(b)
elif(ch==2):
c=input("enter the fruit to be sold")
if(c in list):
list.remove(c)
else:
print('Fruit does not exist')
print('Updated List is:\n',list)
Hii I am Ankeeta
cart=["apple","mango","banana","pineapple","grapes","orange"] fruit_name=input('Enter the fruit name') c=int(input('What do you want to do : 1.BUY \n 2.SELL')) if(c=='1'): c.append(fruit_name) print('Fruit added to list') elif(c=='2'): c.remove(fruit_name) print('Fruit added to sell') else: print('Invalid Operation...…..') print('Updated list is : \n',cart)
`print ("Welcome") fruits_available = ["orange","Banana","Pineapple","Mangoes","Kiwi","Grapes"] print("Fruits Available") for fruits in fruits_available : print(fruits)
print ("1. Purchase") print ("2. Sell") choice = int(input("Enter choice(1/2): ")) if (choice == 1): fruit_add = input("Enter the fruit you want to purchase:") print ("The added fruit is",fruit_add) fruits_available.append(fruit_add) print(fruits_available) elif (choice == 2): fruit_remove = input("Enter the fruit you want to Sell:") print ("The sold fruit is",fruit_remove) fruits_available.remove(fruit_remove) print(fruits_available) else : print("Invalid Option")`
This task is only for COSS Leap2.0 Students.
Note: Your List should contain minimum 6 elements.
IMP : Markdown language practice is must.