-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariable.py
45 lines (36 loc) · 1012 Bytes
/
variable.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Variables in Python
# Variables are used to store values in memory
# Variables are created when you assign a value to it
# Integer
x = 5
print(x)
# String
x = "Hello World"
print(x)
# Float (floating point number)
x = 20.5
print(x)
# Boolean
x = True
print(x)
# Multiple Assignment
x, y, z = "Orange", "Banana", "Cherry"
print(x)
print(y)
print(z)
# Assign the same value to multiple variables in one line
x = y = z = "Orange"
print(x)
print(y)
print(z)
"""
# Variable Names Rules
1. Variable names are case-sensitive (age, Age and AGE are three different variables)
For Example: age is not the same as Age
2. A variable name must start with a letter or the underscore character
For Example: _age and age_1 are valid variable names
3. A variable name cannot start with a number
For Example: 1age is not a valid variable name
4. A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
For Example: my-age and my age are not valid variable names
"""