2024-09-27 07:32:24 发布
网友
我试过很多方法,但仍然找不到一个方法让它工作! 我试着做一个变量,把每轮之后的总数加起来endtotal = endtotal + totalscore。 我还没有尝试过其他方法,但我想我会先问一下,所以我不会尝试不同的方法,每次都失败
endtotal = endtotal + totalscore
不考虑操作发布代码:使用while循环和要在外部设置的变量。在循环外使用vars的示例中,endtotal是每轮增加定义的totalscore,并在末尾打印为总和
count_rounds = 0 rounds = 10 endtotal = 0 totalscore = 69 while count_rounds < rounds : endtotal = endtotal + totalscore count_rounds += 1 print ("I'm done with the rounds counting. End score: %s" % endtotal)
当您检查这个示例时,您将了解它的诀窍以及如何实现(我想你知道如何使用defs)解决这个问题。好好享受
不考虑操作发布代码:使用while循环和要在外部设置的变量。在循环外使用vars的示例中,endtotal是每轮增加定义的totalscore,并在末尾打印为总和
当您检查这个示例时,您将了解它的诀窍以及如何实现(我想你知道如何使用defs)解决这个问题。好好享受
相关问题 更多 >
编程相关推荐