[英]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.