How do if statements work?

前端 未结 1 1094
有刺的猬
有刺的猬 2021-01-19 08:58

I am making a text based russian roulette game in Python, but I am not nearly finished, as one can see just by looking at my code:

#!/usr/bin/env python
prin         


        
相关标签:
1条回答
  • 2021-01-19 09:35

    Use raw_input for your paname and pbname variables. Be sure to import random at the top of your file. It would also be better to use int(raw_input("How many...")) for bulletcounter, too, I think, than input, since this can be used to evaluate any arbitrary python code.

    Also, it would be worth checking to see which version of Python you are using, when you invoke it using the env command. If, at the command line, you run:

    /usr/bin/env python -V
    

    and are getting "Python 2.x.y" instead of Python 3, and you are expecting to be using Python 3, consider changing that first line to call your Python 3 interpreter instead. The recommendations noted above assume you are using Python 2.

    0 讨论(0)
提交回复
热议问题