Computer Science, asked by JosanMedia, 8 months ago

program to convert a string into an integer number and integer into floating point number in python​

Answers

Answered by lovelysoul05
2

Answer:

use the int() function. This function takes two parameters: the initial string and the optional base to represent the data. Use the syntax print(int("STR")) to return the str as anint , or integer.

Answered by fionasara19
0

Answer:

# Python code to demonstrate Type conversion  

# using int(), float()  

# initializing string  

s = "10010"

# printing string converting to int base 2  

c = int(s,2)  

print ("After converting to integer base 2 : ", end="")  

print (c)  

# printing string converting to float  

e = float(s)  

print ("After converting to float : ", end="")  

print (e)  

Explanation:

Similar questions