Non-strings and strings


#1


Can someone explain me why we have to use srt() to convert non-strings into strings? Wold not be the same if insted of that we just add the "..".
Like: 6=str(6)="6"


Replace this line with your code.


#2

but what if you integer is stored in a variable?


#3

You're saying like this:

hi=6;
print " hi, my friends"

the output would be "6, my friends"?


#4

no, i am saying you can't just put "" around hi, given it then will just be read as string, not a string version of the integer


#5

Can you tell me what is the difference between been "read as string" and "string version of the integer"?


#6

hi=6
hiStr = str(hi)

hiStr is now contains "6", a string. Strings are pieces of information between qoutation marks, so 6 is an integer, "6" is a string


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.