%%bash
#Check version of Java 
 java_version=$(java -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*/\1\2/p;')
#Check version of Python
 python_version=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'`
#Print using conditional statement
 if [ $java_version > "0" ]; then
   echo "Java version: "$java_version
 else
   echo "Java not installed"  
 fi
if [ $python_version > "0" ]; then
   echo "Python version: "$python_version
 else
   echo "Python not installed"  
 fi
Java version: 110
Python version: 3.9.12