如何更新函数的返回值。蟒蛇

时间:2020-09-21 04:29:57

标签: python-3.x function

我正在制作一个简单的游戏,其中用户尝试猜测计算机的号码或计算机尝试猜测用户的号码。当我运行程序时,我收到启动消息(播放1、2或按4退出),我可以选择游戏模式1或2并通过它们进行播放,但是当我不想再次播放时,我返回进入主菜单以选择其他游戏模式或结束游戏中的儿童车。当尝试从1或2更改或退出时,它只是从一开始就继续玩已经选择的游戏模式,如果您尝试从开始退出而不选择游戏模式,则会给您结束消息(感谢您玩!),然后它立即给出错误信息:

 {% for a in datas %}
<button type="button" class="btn btn-primary" data-toggle="modal" data- 
  target="#exampleModal">
  {{a.product_id}}
   </button>
  {% endfor %}

  <!-- Modal -->
 <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria- 
  labelledby="exampleModalLabel" aria-hidden="true">
 <div class="modal-dialog" role="document">
<div class="modal-content">
  <div class="modal-header">
    <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>
  <div class="modal-body">
    <tr>
     <td>{{datas.name}}</td>
     <td>{{datas.price}}</td>
     <td>{{datas.category}}</td>
    </tr>
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
    <button type="button" class="btn btn-primary">Save changes</button>
  </div>
</div>

我知道这很可能是我的主菜单功能和检查游戏模式的代码有问题。请解释我做错了什么以及如何解决该问题,谢谢。我是编码的新手,所以对您有帮助。这是完整的程序:

 Traceback (most recent call last):
          File "main.py", line 122, in <module>
            while not is_playing_hg:
        NameError: name 'is_playing_hg' is not defined

0 个答案:

没有答案