+ 1

Anyone can explain this code?

import math x="a" x+=str(math.sqrt(25)) print(x) output: a5.0

19th Apr 2018, 1:21 PM
Mahmudul Hasan Fahim
Mahmudul Hasan Fahim - avatar
3 Answers
+ 4
math.sqrt(25)= 5.0 #return type is float x+=str(5.0) print(a) - a5.0
19th Apr 2018, 1:28 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 1
x is a string math.sqrt(25) is a string The + sign concatenates strings: a = "as" b = "tra" c = a + b c = "astra"
23rd Apr 2018, 7:12 AM
Johannes
Johannes - avatar
0
it says x is letter "a" then it adds the square root of 25 into x so it becomes a5.0
19th Apr 2018, 2:23 PM
Markus Kaleton
Markus Kaleton - avatar