[英]how i can solve : can't multiply sequence by non-int of type 'float' (python)
[英]How do I solve the issue “can't multiply sequence by non-int of type 'float'” in python
string = (input("Input a string of random chars! "))
multi = int(len(string))
multi1 = float(multi)
print(multi)
print(("-") * round((multi * 10),1))
print("|", ("_") * round((multi1/2),1), "|")
您需要int
來重復字符串
print("|", ("_") * int(round((multi1/2),1)), "|")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.