-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariable.py
More file actions
39 lines (30 loc) · 954 Bytes
/
variable.py
File metadata and controls
39 lines (30 loc) · 954 Bytes
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
# This is a simple Python script that demonstrates variable assignment and usage.
name = "John"
age = 30
print("Name:", name)
print("Age:", age)
# More examples
height = 175.5
is_student = True
print("Height:", height)
print("Is Student:", is_student)
# Demonstrating variable reassignment
age = 31
print("Updated Age:", age)
# Using variables in expressions
print("Next Year Age:", age + 1)
# Using variables in more complex expressions
print("In 5 Years, Age:", age + 5)
# Using variables in more complex formatted strings
print(f"Name: {name}, Age: {age}, Height: {height}, Is Student: {is_student}")
# End of variable demonstration
# This script covers basic variable usage in Python.
# More complex variable usage
weight = 70.05
print("Weight:", weight)
# Expressing weight in different units
weight_kg = weight / 2.205
print(f"Weight in kg: {weight_kg:.2f}")
# Demonstrating boolean variable usage
is_male = True
print("Is Male:", is_male)