COMPSCI 1MD3 Lecture 4: Aspects of Programming Languages - Python Semantics & Syntax
Document Summary
Python: literals (e. g. , the number 3. 2 and the string abc or 123 ) and operators (e. g. , + and /) English: it defines which strings of words constitute well-formed sentences. English: it defines which sentences are meaningful. I are hungry" -syntactically valid but static semantic error. Python: it decides which syntactically valid strings have a meaning. 3 + hi -syntactically valid but static semantic error. English: it defines the meaning of those sentences. I cannot praise this student too highly, -can be ambiguous. Python: it associates a meaning with each syntactically correct string of symbols that has no static semantic errors. 3 + 2 have only one meaning. Objects have a type that defines the kinds of things programs can do to them. Bool represent boolean values true and false. None special and has one value, none. To find the type of an object, use type(). Can convert object of one type to another.