Using python
val = '123,000'
string `val` is an integer, but it has comma in it.
Write code to remove the comma, and parse its value into an integer
val='123,000'
print('string with commna ' + val)
val=val.replace(',','') #used replace function to replace comma with nothing
print('string after removing comma ' + val)
integer = int(val) #used int function to convert string to int
print('integer converted from string is ')
print(integer)
Get Answers For Free
Most questions answered within 1 hours.