+ 21
In this case, float 7.0 is an integer - why not multiply it with it ¿?
3 Respuestas
+ 20
Thanks Jakob Marley !¡
Хвала Jakob Marley !¡
+ 10
To sum it up, you can't multiply a string by an float in Python. When you multiply the string by an int, you're basically just telling it how many times to print that string. When you try to use a float, it's considering it actual math and math doesn't like calculating with strings. Why it does it with a float is because you can't print a string 7.2 times, you either print it X times or you don't, it's not a gray area type of deal.
+ 6
Multiplying a list is defined for a list and an integer.
It is clear for
print("4" +2)
The operator + is not defined for string and int.
The syntaxchecker sees a list and a float.
--> Error Error Error
and before you can discuss with it
(--> hey come on ! 7.0 is 7)
... it has stopped all work and wont listen and even not discuss with you
Sure it sounds a bit hardhearted, but actually the interpreter feels a
an educational mission for coder.