Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why is it crushing ?
#9
(Jan-26-2018, 03:59 PM)sparkz_alot Wrote: I've modified j.crater's code (the 'print' functions) so no conversion is necessary (still in Python 3)

Your other problem, is your initial "if" statement if fish == "fish": will always evaluate as true, so none of the "elif's" will be looked at. You could create a list of options, say choices = ['common', 'uncommon', 'garbage'] then randomly select one of those (Hint: Random), you could then have:
if choices == 'common':
    do something
elif choices == 'uncommon':
    do something
elif choices == 'garbage':
    do something
Another problem, is I can fish myself into debt as you have made no action to be taken if I reach 0 coins.

There are other smaller items that could be addressed, but I think you'll be fine if you handle the big problems first.

As to the error you are receiving, it's because in your code you've used both tabs and spaces for indentation. In Python, you should always use 4 spaces for indentation

And yes, by all means switch to Python 3 (3.6.4 if possible)
thanks very much it's working great now gonna do what you said about choice atm
Reply


Messages In This Thread
why is it crushing ? - by Cheetos - Jan-26-2018, 01:29 PM
RE: why is it crushing ? - by j.crater - Jan-26-2018, 01:58 PM
RE: why is it crushing ? - by j.crater - Jan-26-2018, 02:14 PM
RE: why is it crushing ? - by Cheetos - Jan-26-2018, 02:17 PM
RE: why is it crushing ? - by j.crater - Jan-26-2018, 02:25 PM
RE: why is it crushing ? - by Cheetos - Jan-26-2018, 02:33 PM
RE: why is it crushing ? - by sparkz_alot - Jan-26-2018, 03:59 PM
RE: why is it crushing ? - by Cheetos - Jan-26-2018, 05:47 PM
RE: why is it crushing ? - by mepyyeti - Jan-26-2018, 06:17 PM
RE: why is it crushing ? - by league55 - Jan-26-2018, 05:34 PM
RE: why is it crushing ? - by DeaD_EyE - Jan-26-2018, 06:46 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020