Code line explaination

print("Sensor value is: " + str(data['value']))

Please explain me this line of code of project 9 in simple words.

Basically to output the sensor reading.

1 Like

Hi @pragatighatte

It prints the sensor value (string) and adds the string value.
The str() function converts values to a string form so they can be combined with other strings

1 Like

data is json.loads(some_json_object) object then we are fetching value from data as it is written data[‘value’] and then we are passing it in str() function which convert it into string and then appending it to the string "Sensor value is: "
to read more about json https://www.w3schools.com/python/python_json.asp

1 Like