


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Python language for beginners - Daff
Typology: Summaries
1 / 4
This page cannot be seen from the preview
Don't miss anything!
Example: coordinates = (3, 7) (toa do) Tuples: Suitable when you want to ensure that the data remains constant and cannot be accidentally modified. Often used for representing fixed sets of values.
Addition (+): Adds two operands. Subtraction (-): Subtracts the right operand from the left operand. Multiplication (): Multiplies two operands. Division (/): Divides the left operand by the right operand (always returns a float). Modulus (%): Returns the remainder of the division of the left operand by the right operand. (tìm số dư của phép chia) Exponentiation (*)(lũy thừa): Raises the left operand to the power of the right operand.
age = 20 if age < 18 : print("You are a minor.") elif 18 <= age < 21 : print("You are an adult, but not yet allowed to drink.") else: print("You are a legal adult.")
The code above contains a simple Python function called greet(). When 'called' or 'invoked', this function prints "Hello, World!" to the console.