w3resource
Python Exercises

Python: Print a variable without spaces between values

Python Basic: Exercise-135 with Solution

Write a Python program to print a variable without spaces between values.

Sample value : x =30
Expected output : Value of x is "30"

Sample Solution:-

Python Code:

x = 30
print('Value of x is "{}"'.format(x))

Sample Output:

Value of x is "30" 

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 input two integers in a single line.
Next: Write a Python program to find files and skip directories of a given directory.

What is the difficulty level of this exercise?