![](/img/trans.png)
[英]Python - How do i make this RNG program continue to run for x amount of times after generating the number once
[英]How do I input a number and make that number display a symbol that amount of times?
我正在嘗試制作一個程序,該程序以數字作為輸入,而輸出則以#個符號表示。 我到了-
Hash = input(“Enter a number? “)
但是我不知道如何使用該輸入多次顯示#。 例如
Enter a number? 6
(printed)######
誰能告訴我該怎么做?
如果需要打印n
次符號#
:
print('#'*n)
請記住正確縮進您可以使用:
Hash=int(input("Please enter a number: "))
for each in hash:
print("#")
這個簡單的代碼將提供您想要的結果。 n=int(input(“Enter a number? “)) print('#'*n)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.