我正在创建一个程序,它将接收输入,并在列表中围绕输入输出打开和关闭html标记。显然,下面的代码只会打印上次运行count
次时输入的最后一个输入。我猜在每个过程中必须基于count
创建一个新变量。我如何做到这一点
runNum = int( input( "How many items are you entering? : "))
print ("Type 1 if you would like to use the li tag or type 2 for the th tag")
descVar = input("")
if descVar == "1":
for count in range ( 1, runNum + 1):
print ("Please enter item #", count, "")
item = input()
for count in range (1, runNum):
print ( <li>, item, </li> )
只需在列表中收集输入:
相关问题 更多 >
编程相关推荐