0

How to define stings and integer literals in Python while creating a code?

12th Apr 2020, 1:46 PM
Sneha Rani
2 Respuestas
+ 2
Strings can be converted to numbers by using the int() and float() methods. If your string does not have decimal places, you'll most likely want to convert it to an integer by using theint() method. Because the two numeric values were stored in strings, we received an error
12th Apr 2020, 2:16 PM
Ayush Kumar
Ayush Kumar - avatar
+ 1
Not sure what you mean by "define"here ... "This is a sentence" # string literal 12345 # integer literal 123.45 # floating point literal Literals are values of a certain type, and can be assigned to variables, used in comparison etc. Literals cannot be changed, until they are stored in a variable.
12th Apr 2020, 2:32 PM
Ipang