Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- train/test
- break
- SQL
- Python
- machine learning
- __init__
- start exercise
- line width
- PANDAS
- matplotlib
- matplotlib.pyplot
- iterates
- error
- AS
- Text Analytics
- pie charts
- variables
- data distribution
- self parameter
- line color
- Default X points
- MySQL
- continue
- For loops
- Github
- Else
- Text mining
- multiple lines
- PROJECT
- polynomial regression
Archives
- Today
- Total
Data Science Explorer
[Basic Grammar] Python Variables: Assign Multiple Values 본문
반응형
- Many Values to Multiple Variables
We can assign values to multiple variables in one line.
Example
x, y, z = "Nike", "Adidas", "Puma"
print(x)
print(y)
print(z)
- One value to Multiple Variables
Assigning the same value to multiple variables in one line
Example
x = y = z = "Honeydew"
print(x)
print(y)
print(z)
- Unpack a Collection
When you want to extract the values from the collection of values in a list, tuple etc, you can use unpacking.
Example
fruits = ["apple", "banana", "cherry"]
x, y, z = fruits
print(x)
print(y)
print(z)
'Python' 카테고리의 다른 글
[Basic Grammar] Python Numbers (0) | 2023.10.20 |
---|---|
[Basic Grammar] Python Data Types (0) | 2023.10.20 |
[Basic Grammar] Python Variables: Output Variables (0) | 2023.10.19 |
[Basic Grammar] Python Variables: Variable Names (0) | 2023.10.15 |
[Basic Grammar] Python Variables (0) | 2023.10.15 |