Python dasturlash tilida o’zgaruvchi
Download 12.82 Kb.
|
Python dasturlash
Python dasturlash tilida o’zgaruvchi In Python, variables are used to store data values. The type of a variable determines what kind of data it can hold. Here are some common variable types in Python: 1. Integer (int): Represents whole numbers, positive or negative, without any decimal points. Example: x = 5 2. Float: Represents floating-point numbers, which include decimal points. Example: x = 3.14 3. String (str): Represents a sequence of characters enclosed in single quotes ('') or double quotes (""). Example: name = "John" 4. Boolean (bool): Represents either True or False. Example: is_true = True 5. List: Represents an ordered collection of items, enclosed in square brackets ([]), separated by commas. Example: numbers = [1, 2, 3, 4] 6. Tuple: Similar to a list, but it is enclosed in parentheses (()) instead of square brackets. Tuples are immutable, meaning their values cannot be changed after they are created. Example: coordinates = (3, 4) 7. Dictionary: Represents a collection of key-value pairs, enclosed in curly braces ({}) with each pair separated by commas. Example: person = {"name": "John", "age": 25} 8. None: Represents the absence of a value. Example: x = None These are just a few examples of variable types in Python. The type of a variable can be checked using the `type()` function. Download 12.82 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling