On 10/13/2018 4:25 AM, Mariam Haji wrote:
...
Your problem intrigued me enough to spend some time "fixing" your
program so it will compile with no errors and run at least the initial
case where I entered "shoot!"
Here are the problems I found: (line numbers refer to your original code)
- spell
More comments:
User Friendly?
I hope this game is not intended for actual use. No one will be able to
guess the correct actions in a reasonable time. or 3 digit random code
given 10 tries for any one code. I for one would give up pretty quickly.
The original colossal
On 10/14/2018 10:08 AM, bob gailer wrote:
> Python coding "trick"1
> when I build a map I omit the () after the class e.g. 'death' = Death,
> ... and apply them to the item retrieved from the map.
>
> use a decorator to build the map dictionary:
>
> # the decorator fun
I'm replying back to the tutor list. Can you reply there rather than
directly to me please?
Also I've moved your response below mine as that is the preferred
style on this list. My answer is below.
On Sun, 14 Oct 2018 at 16:05, Mariam Haji wrote:
>
> On Sat, Oct 13, 2018 at 10:24 PM Oscar Benjam
On 10/14/2018 1:42 PM, Mats Wichmann wrote:
Hint here: don't use 'map' as your own variable name, since it's a
built-in function.
Absolutely, I am always warning others about this gotcha. In this case
map is local to add_to_map so it does not affect then global namespace.
The reason I used it
More comments on code:
guess = raw_input("[pod #]> ")
if int(guess) != good_pod:
If user enters something that will not convert to integer an exception
will be raised. For example
>>> int('a')
Traceback (most recent call last):
File "", line 1, in
ValueError: invalid literal