That's cool!
This game is too good! Also, got a score of 2519!
Heyy dude, Great code! But just one suggestion, maybe instead of showing the food in list form, you can make it so that the list of foods is indexed like so:
[1] Burger
[2] Pizza
[3] Roasted Fish
So that if a user wants to sell an item, he doesnt have to type in the whole name of the item letter by letter, and can just type "2" if he wants to sell "Pizza", hope you understood and make that change.
:D Good luck for your future projects!!
@Persassy2109 That's great!
It is a good game, but you can make some changes. First, PLEASE change the controls! The shooting must be done by the left mouse button and the movement by the 'w' key. Second, it looks like he is spitting the bullets from his mouth. So please do make the bullets come out of the gun.
I would be really happy if you would make these changes!! :D
@Code1Tech Thanks, that's some helpful input!!!
@Code1Tech Oh my god, thank you so much for reporting that error. I just fixed it. Can you pls say if it works fine now?
ok. What mistake ur making here is that you are not echoing the index of the value 'search' in line 13. Just change the print (str(sortedlist[midlist]))
to print(midlist)
and you'll be fine. Also, what may also have caused the confusion is the elements you chose to use in the list. They are 1 digit elements whose value could have gotten confused with their indexing. You could use a list like sortedList = [10, 10, 20, 30, 40, 80, 100]
for more clarity...
Hope my answer helped!! :D
can you please explain what this code do?
Oh.. My.. God! That's great! Loved it. :D
@ch1cken That's the spirit!! godspeed
Hmmm, that looks interesting!
Hi! Can you please check your code? There is no output, it seems that you have just defined the functions, but haven't called them.
My name is ñ-hismork^ xD
that's some good code! Just a small suggestion, you can make a check when a user enters a string value for the cost. Here's a piece of code to help you out:
def validateVal(v):
try:
x = float(v)
return x
except:
x=validateVal(input("Please enter a valid number: "))
return x
You can use it like so:price = validateVal(input("Enter First Item price: $"))
This will check whether input is a float. If not, it will ask the user to enter the value again, for however times he does the error.
Hope it helped! :D
@Coder100 OH MY GOD!! You are a life saver! Thank you!
@DangHoang2 I tried that, but same error... thank you for replying though :)
LMAO @LTI2
@ReplTalk WOW! That was a quick response (love this community, seriously)
I am a Python beginner. Anyone else with me??
Great code! Love the versatility of the calculator. Just one thing, you can use try and except to handle errors...
I can bet you edited the code lol. @VincentLee4
Hey, not sure if it is a glitch or I am making a mistake, but whenever I input 1 or 2, and press enter, nothing happens and that input 1 or 2 disappears.
EDIT - By the way, just made some changes in the code which may help you...
I defined this function getvalidOpt(), so if you enter any other option except 1 or 2, it will ask you to enter the value again. Here is the code:
Output:
Here, instead of eval, I wrote int and it worked just fine, I did not face the problem I was facing at that time now.
I hope this will help you! :)
Oh, thanks! @robowolf
Great project!! But just a recommendation, please include some error handling so that the code doesn't abruptly stop when the user inputs a wrong option, and asks the user to enter an option again... I would be very happy if you'd do that!!