while循环
课程:Python · 编程练习
Python编程练习 - while循环
练习内容
# 使用while循环计算1到10的和\ntotal = 0\ncount = 1\n\nwhile count <= 10:\n total += count\n count += 1\n\nprint(f"1到10的和是: {total}")\n\n
课程:Python · 编程练习
Python编程练习 - while循环
# 使用while循环计算1到10的和\ntotal = 0\ncount = 1\n\nwhile count <= 10:\n total += count\n count += 1\n\nprint(f"1到10的和是: {total}")\n\n