how to add string to int in python code example
Example 1: print string + int in python
print('sum is : ' +str(25))
Example 2: how to concatenate a string with int in python
string1 = "superman"
num1 = 20
concatString = string1 + str(num1)
print(concatString)
Example 3: concatenate strings and int python
number = [1,2,3,4,5]
number.reverse()
print("Reverse list: "+ str(number))
Example 4: how to convert string to int in python
>>> string = '123'
>>> type(string)
<class 'str'>
>>> integer = int(string)
>>> type(integer)
<class 'int'>
>>> float_number = float(string)
>>> type(float_number)
<class 'float'>
>>> print(string, integer, float_number)
123 123 123.0