Python is a nice language for beginning programming for several reasons. First the syntax is sparse, and clear. Second, the underlying model of how objects and variables work is very consistent. Third, you can write powerful and interesting programs without a lot of work. However, Python is representative of one kind of language, called a dynamic language. In dynamic languages like Python, the type of a variable (whether itβs a number, string, list, etc.) is determined while the program is running, not when you write the code.
In static languages, all variable types need to be declared upfront. You might think of Python as being fairly informal about data types. Java and C++ are more formal about types.
These languages have some advantages of their own. First, is speed: Java and C++ code will generally give better performance than Python code. (See A Note about Python Performance.) Second is their maintainability over time. Maintainability is the ease with which a program can be modified to correct faults, improve performance, or adapt to a changed environment. A lot of what makes Python easy to use is that you must remember certain things. For example, if you set Python variable x to reference a turtle, and forget later that x is a turtle but try to invoke a string method on it, you will get an error. Java and C++ protect you by forcing you to be upfront and formal about the kind of object each variable is going to refer to.
In one sense Python is representative of a whole class of languages, sometimes referred to as scripting languages. Other languages in the same category as Python are JavaScript, Ruby, and Perl. Java is representative of what we might call industrial strength languages. Industrial strength languages are good for large projects with multiple programmers, where being formal and careful about code structure is important because changes made by one person can impact many others. Other industrial strength languages include Rust, C++, C#, and Ada.
Programming languages will always change. As the field of computer science advances there will be new programming languages and you will need to learn them. It is important to learn several programming languages so that you know what to expect. There are certain features that most programming languages have in common; variables, loops, conditionals, functions. And there are some features that are unique. If you know what is common in languages that is a good place to start.
Although Python code is generally slower than Java and C++ code, in practice Python programs can achieve equivalent performance. Performance can be defined as how efficiently software can accomplish its tasks. This can be done by compiling Python code to C code (see: Cython) or by calling high-performance libraries from Python (e.g., NumPy, scikit-learn, etc.). So native language performance is just one criteria to consider when deciding which language to use for a program.