Features#
High-level, interpreted, free and open source, easy syntax, case-sensitive, portable, large library. Modes: interactive (>>> prompt) and script (.py file).
Tokens#
Keywords (if, else, while, for, def, True, None…), identifiers (names - start with a letter or _, no spaces, not a keyword), literals, operators, punctuators.
Data types#
int, float, complex, bool, str, list, tuple, dict, None. Mutable: list, dict, set. Immutable: int, float, str, tuple.
पायथन एक उच्च-स्तरीय, इंटरप्रेटेड और केस-सेंसिटिव भाषा है। input() हमेशा स्ट्रिंग लौटाता है, इसलिए संख्या के लिए int() या float() से टाइप बदलना पड़ता है।
Operators#
| Type | Operators |
|---|---|
| Arithmetic | + − * / // % ** |
| Relational | == != > < >= <= |
| Logical | and, or, not |
| Assignment | = += −= *= /= |
| Identity / membership | is, is not / in, not in |
Precedence (high → low): **, unary −, * / // %, + −, relational, not, and, or.
Exam tips#
- Predict output of expressions with // and %, and type conversion; identify invalid identifiers.