Skip to main content
Added explanatory code outline
Source Link
200_success
  • 145.7k
  • 22
  • 191
  • 481

Your code is pretty good and well written. I would just change a bit the inside of "while flag:" by having the part where you test the validity of cast_again at the end as the last case (else).

That is, instead of

while 1:
    if cast_again not in ('r', 's', 'e'):
        # Handler
        …
        continue   
    if cast_again == 'r':
        …
    elif cast_again == 's':
        …
    elif cast_again == 'e':
        …

write

while 1:
    if cast_again == 'r':
        …
    elif cast_again == 's':
        …
    elif cast_again == 'e':
        …
    else:
        # Handler
        …

Your code is pretty good and well written. I would just change a bit the inside of "while flag:" by having the part where you test the validity of cast_again at the end as the last case (else).

Your code is pretty good and well written. I would just change a bit the inside of "while flag:" by having the part where you test the validity of cast_again at the end as the last case (else).

That is, instead of

while 1:
    if cast_again not in ('r', 's', 'e'):
        # Handler
        …
        continue   
    if cast_again == 'r':
        …
    elif cast_again == 's':
        …
    elif cast_again == 'e':
        …

write

while 1:
    if cast_again == 'r':
        …
    elif cast_again == 's':
        …
    elif cast_again == 'e':
        …
    else:
        # Handler
        …
grammar improvement
Source Link
Pimgd
  • 22.6k
  • 5
  • 68
  • 144

yourYour code is pretty good and well written. I would just change a bit the inside of "while flag:" by having the part where you test the validity of cast_again at the end as the last case (else).

your code is pretty good and well written I would just change a bit the inside of "while flag:" by having the part where you test the validity of cast_again at the end as the last case (else).

Your code is pretty good and well written. I would just change a bit the inside of "while flag:" by having the part where you test the validity of cast_again at the end as the last case (else).

Source Link

your code is pretty good and well written I would just change a bit the inside of "while flag:" by having the part where you test the validity of cast_again at the end as the last case (else).