'Why m i not getting expected result of python --version?

In linux Debian9, I want comma seperated output of python3 and python2

I am writing this command:

echo $(python3 --version),$(python2 --version)

Output should be like this:

Python 3.7.3,Python 2.7.16

But I am getting output:

Python 2.7.16
Python 3.7.3,


Solution 1:[1]

Simplest approach to do this:

echo $(python3 --version),$(python --version 2>&1)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Khawar