What does (str(y) mean | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

What does (str(y) mean

I'm struggling on what this piece of code means Could you explain what this code means so a 10 year old wow understand it please

2nd May 2019, 6:20 AM
R U Legend
R U Legend - avatar
1 Respuesta
+ 1
str is function that converts it parameter(y) to string Here is an example: var = 45 notInt=str(var) This will work: print(notInt[1]) since string in python is array of chars This will give a error: print(var[1]) since it is int and not an array of digits
2nd May 2019, 7:03 AM
Dima Makieiev
Dima Makieiev - avatar