Python statement ends with the token NEWLINE character. # Output Area of rectangle: 50 Multi-Line Statements We can add multiple statements on a single line separated by semicolons, as follows: # two statements in a single In Python, comments describe what code is doing so other people can understand it. In Python, we use the hash ( #) symbol to start writing a comment. Also, we have added the comments in our code. If there is more than one statement, the result appears only one time when all statements execute.Īs you can see, we have used three statements in our program. Assignment statements don’t produce a result it just assigns a value to the operand on its left side.Ī Python script usually contains a sequence of statements. The result of a print statement is a value. The print and assignment statements are commonly used. There are mainly four types of statements in Python, print statements, Assignment statements, Conditional statements, Looping statements. There are other kinds of statements such as if statement, for statement, while statement, etc., we will learn them in the following lessons. where a is a variable name and 10 is its value. It means each line in a Python script is a statement.įor example, a = 10 is an assignment statement. So, in simple words, we can say anything written in Python is a statement. A statement is an instruction that a Python interpreter can execute.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |