Is python a weakly typed language?

anonymity
Release: 2019-06-15 09:56:45
Original
6501 people have browsed it

Is python a weakly typed language? No, Python is a strongly typed dynamic scripting language

Strong type: does not allow the addition of different types

Dynamic: does not use explicit data to declare the type, and determines the value of a variable The type is when it is assigned a value for the first time

Script language: It is generally an interpreted language. Running the code only requires an interpreter and does not require compilation

Is python a weakly typed language?

Here is a comparison between strong typing and weak typing:

python code:

>>> 3+6 9 >>> "3"+6 Traceback (most recent call last): File "", line 1, in  TypeError: Can't convert 'int' object to str implicitly >>> "3"+"6" '36' >>> "6"-"3" Traceback (most recent call last): File "", line 1, in  TypeError: unsupported operand type(s) for -: 'str' and 'str'
Copy after login

javascript code :

3+6 9 "3"+6 "36" "3"+"6" "36" "6"-"3" 3
Copy after login

The above is the detailed content of Is python a weakly typed language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!