25th Feb 2020, 3:46 PM
mohsin khan
mohsin khan - avatar
7 Respuestas
+ 3
You can also do it without type convertion by using a comma: print('your weight in Kg: ', kweight)
25th Feb 2020, 6:54 PM
Lothar
Lothar - avatar
+ 2
thanx guys, i got to know that even in print function you can only concatinate a string WITH A string. python itself said so...
25th Feb 2020, 4:08 PM
mohsin khan
mohsin khan - avatar
+ 1
u can t add a string to a float u have to convert it
25th Feb 2020, 3:54 PM
Othmane DAHI
Othmane DAHI - avatar
+ 1
Also you can use a f-string. print(f'Your weight: {kweight}')
26th Feb 2020, 12:04 AM
GeraltdeRivia
0
to a string
25th Feb 2020, 3:55 PM
Othmane DAHI
Othmane DAHI - avatar
0
u have to replace it with str(kweight)
25th Feb 2020, 3:55 PM
Othmane DAHI
Othmane DAHI - avatar