13 AnswersNew Answer
Mani working fine now. https://code.sololearn.com/c3XJxgD14t9S/?ref=app edited: what you mean by your second question.kindly explan it
Mani This is how split works. https://code.sololearn.com/cl3WhHawve6v/?ref=app
Hey split() is not working as you have added the parenthesis. So remove the brackets in the y variable and then add a semicolon ";".
But what about the 'split()' Can even correct me where did I go wrong ??
What you want to do explain ? I could'nt get your point.
Explanation: you are printing ingredients as it is not its value. eg. a=2 print("a") This prints a character a . So to print its value you have to write it in print statement without quotation marks. Like this. a=2 print(a) Output is 2
Broi, I understand that one. Thanks again for explaining my mistake. But I have used a list () statement in top of my code and split() statement at the end of code. Notice !! . The thing I am trying to figure out why isn't split() doesn't work ??
Oh !! Got it
Finally figured it out. Thanks a lot Muhammad Bilal
you should change all if condition into elif just no 1 condition if ..and last condition else x = ("Welcome To The Supermarket") print(list(x)) ingredients = ['Wheat','Rice','Corn','Dal','Groundnut','Butter'] if 'Wheat' in ingredients: print("Its Packed") elif 'Rice' in ingredients: print("We Don't Sell Rice") elif 'Corn' in ingredients: print("You Have Recieced an Discountl") elif 'Dal' in ingredients: print("Do You Need moong Dal Or massor dal") elif 'Butter' in ingredients: print("You Dont Have Enough Money, \nSo Select Either,ingredients,'or',ingredients ") print('Milk' not in ingredients) elif 'Milk' in ingredients: print("not again") else: y = ("Thanks For Shopping. Do Visit Again") print(y.split(" "))
I was just trying to make use of split() and list() in one of my statements. list () is working but split() doesn't ??
(A) cause you wrote it within quotes, you shall write it outside quotes.... (B) split is working dude...