Java and Python are high-level programming languages that are very different. Python appeared earlier than Java, as it appeared in 1991 while Java appeared in 1995. Java and Python handle variables differently. Java codes are longer than Python codes.
Comparison chart
Typing discipline
Java is statically typed, and so it forces a computer programmer to define the type of a variable when he first declare it and will not allow him to change the type later in the program. Python is dynamically typed and a programmer can just use his variables as he wants to without worrying too much about their types.
Code separation
Kasia Mikoluk says that Python is unusual among programming languages in that it uses indentation to separate code into blocks, while Java uses curly braces to define the beginning and end of each function and class definition. The advantage of using indentation is that it forces the programmer to set his program out in a way that is easy to read, and there is no chance of errors resulting from a missing brace.
Code length
Larry Wall says that Java codes are heavyweight and verbose. The Python website says that Python codes are 3-5 times shorter than Java codes.
Ease of use
Python is easier to use than Java because its code is shorter and the programming language is dynamically typed.
Comments: Java (programming language) vs Python