Python
[Basic Grammar] Python Variables: Output Variables
grace21110
2023. 10. 19. 20:11
반응형
- Output Variables
The print() function is used to output variables.
Example
x = "Hello World"
print(x)
- Output Multiple Variables
- It can be separated by a comma.
Example
x = "Hello"
y = "World"
print(x, y)
- You can also use the + operator to output multiple variables.
Example
x = "Python "
y = "is "
z = "awesome"
print(x + y + z)
** When you try to combine a string and a number with the + operator, it will give you an error. **
** If you want to print out variables that are different data types, use comma. **