【发布时间】:2020-10-22 01:29:08
【问题描述】:
Hi, Disclaimer: I am new to python and coding in general
我正在尝试制作一个简单的应用程序,它将打印一个单词特定的次数。
现在运行我的代码,尽管我最初输入了(次),但程序在退出前只会打印(单词)一次。
这是我的代码:
# Double Words
times = input('Ho w many times would you like to repeat your word?')
word = input('Enter your word:')
for times in times:
print(word)
【问题讨论】:
-
使用范围函数,
for i in range(int(times)) -
这能回答你的问题吗? How to print a string multiple times?
标签: python python-3.x python-2.7