【发布时间】:2018-10-21 08:22:41
【问题描述】:
for (length, freq) in word_list:
print(freq_temp.format(length, freq))
print("\n Len Freq Graph")
for (length, freq) in word_list:
graph_template = "{:>4}{:>5}% {}"
number_symbol = "=" * percentage_frequency(freq, new_list)
print(graph_template.format(length, percentage_frequency(freq, new_list),number_symbol))
如何将这些 for 循环转换为 while 循环?
【问题讨论】:
-
为什么要把它转换成
while循环?您在使用for循环时遇到了什么问题? -
什么是
while循环与for循环的比较? -
我只是好奇你会怎么做。我已经完成了其他转换,但这一次让我很困惑。
标签: python