knoblin
knoblin

Reputation: 1

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), "|")

Upvotes: 0

Views: 83

Answers (1)

ewwink
ewwink

Reputation: 19154

you need int to repeat the string

print("|", ("_") * int(round((multi1/2),1)), "|")

Upvotes: 1

Related Questions