forked from ZCW-Spring26/CodeGo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvars.py
More file actions
53 lines (51 loc) · 1000 Bytes
/
vars.py
File metadata and controls
53 lines (51 loc) · 1000 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
age = 25
score = 100
negative = -10
sum_total = age + score
print(f"Age: {age}")
print(f"Score: {score}")
print(f"Sum: {sum_total}")
>>> is_student=True
>>> is_student
True
>>> has_passed_exam= False
>>> has_passed_exam
False
>>> result = 10 > 5
>>> result
True
>>> is_equal = (15 == 15)
>>> is_equal
True
>>> price = 19.99
>>> price
19.99
>>> temperature = -2.5
>>> temperature
-2.5
>>> result = 10.5 + 3.7
>>> result
14.2
>>> division = 10.0 / 3.0
>>> division
3.3333333333333335
>>> name = John
Traceback (most recent call last):
File "<python-input-16>", line 1, in <module>
name = John
^^^^
NameError: name 'John' is not defined
>>> name = "John"
>>> name
'John'
>>> greeting = "Hello World"
>>> gretting
Traceback (most recent call last):
File "<python-input-20>", line 1, in <module>
gretting
NameError: name 'gretting' is not defined. Did you mean: 'greeting'?
>>> greeting
'Hello World'
>>> formatted = f"{name} says {greeting}"
>>> formatted
'John says Hello World