0

can string be multiplied by float?

string

10th Jul 2016, 1:42 PM
shubham sehgal
shubham sehgal - avatar
6 Answers
+ 1
The * operator is used for multiplication when it operates in two integer or floating-point values. But when the * operator is used on one string value and one integer value, it becomes the string replication operator...
10th Jul 2016, 4:44 PM
Francisco Gómez García
Francisco Gómez García - avatar
+ 1
The * operator can be used with only two numeric values (four multiplication) or one string value and one integer value (for string replication). Otherwise, Python will just display an error message.
10th Jul 2016, 4:45 PM
Francisco Gómez García
Francisco Gómez García - avatar
0
No you can't.. Type error will occur
10th Jul 2016, 2:47 PM
Rahul
0
No. You can't but... why you want to try that? I mean, what would you like to do?
10th Jul 2016, 4:24 PM
Francisco Gómez García
Francisco Gómez García - avatar
0
see i can multiply string with integer ....so i wasn't sure about float
10th Jul 2016, 4:31 PM
shubham sehgal
shubham sehgal - avatar
0
You can typecast the string.
10th Jul 2016, 8:58 PM
Varun Sharma
Varun Sharma - avatar