Answer Posted / chaitanya
Python contains several built-in functions to convert values from one data type to another data type.
The int function takes string and coverts it to an integer.
>>>s = "1234" # s is string
>>>i = int(s) # string converted to int
>>>print i+2
-------------------------
1236
The float function converts strings into float number.
>>>s = "1234.22" # s is string
>>>i = float(s) # string converted to float
>>>print i
-------------------------
1234.22
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does exit () do in python?
Tell me the use of the split function in python?
Explain docstring in python?
What is a character?
What are the ones that can be used with pandas?
What is python used for at google?
Difference between python list comprehension vs. Map?
What are the uses of List Comprehensions feature of Python?
Tell us what is python?
Write a program to draw a board ex: 3by3 or 4by4 etc?
how do you reverse a list in python?
Tell me how do you debug a program in python? Is it possible to step through python code?
What is dictionary in python?
What does isnull mean in python?
What is the dictionary?