w3resource

Python: Convert integer to string

Python Basic - 1: Exercise-144 with Solution

Write a Python program to convert integer to string.

Sample Solution-1:

Python Code:

language = "Python"
version = 3.6
print('Language: ' + language + ',' + ' Version: ' + str(version))

Sample Input:
language = "Python"
version = 3.6

Sample Output:

Language: Python, Version: 3.6

Sample Solution-2:

Python Code:

language = "Python"
version = 3.6
str_version = '{}'.format(version)
print('Language: ' + language + ',' + ' Version: ' + str_version)

Sample Input:
language = "Python"
version = 3.6

Sample Output:

Language: Python, Version: 3.6

Sample Solution-3:

Python Code:

language = "Python"
version = 3.6
str_version = "%s" % version
print('Language: ' + language + ',' + ' Version: ' + str_version)

Sample Input:
language = "Python"
version = 3.6

Sample Output:

Language: Python, Version: 3.6

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:


Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to print Emojis using unicode characters or CLDR (Common Locale Data Repository ) short names.
Next: Write a Python program to find the largest and smallest digit of a given number.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.