List_of_numbers1to19 = ['one', 'two', 'three', 'four', 'five', 'six', 'seven',
'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen',
'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen',
'nineteen']
List_of_numbers1to9 = List_of_numbers1to19[0:9]
List_of_numberstens = ['twenty', 'thirty', 'fourty', 'fifty', 'sixty', 'seventy',
'eighty', 'ninety']
for i in List_of_numbers1to19:
print(i)
list_of_numbers21to99 = []
count = 19
tens_count = 0
for j in List_of_numberstens:
for k in List_of_numbers1to9:
if tens_count%10 == 0:
#should print an iteration of List_of_numberstens
tens_count +=1
tens_count +=1
print(j, k)
正如你所看到的,这是越来越乱了:P所以对不起。 基本上我试图用三个不同索引来打印它们。我已经尝试切分列表并将列表编入索引,但我一直获得数字乘以10的输出作为List_of_numberstens
的完整列表。从1-100中打印数字作为Python中的单词3
我想这很清楚我在这里要做什么。
在此先感谢您的帮助!
阅读有关'dict's – dawg
看[num2words] (https://pypi.python.org/pypi/num2words) – dawg
:P我知道,我只是想弄清楚如何在for循环中嵌入for循环。 – snuffles101