-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
61 lines (49 loc) · 807 Bytes
/
test.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Test Python code (test.py)
# This is a comment
# Variable declarations
a = 0
b = 0
c = 0
d = 0
e = 21
f = 15
z = 99
# Decimal numbers
decim = 1.2
other = 2.5
sumOfDecimals = decim + other
print(sumOfDecimals)
sumIntAndDecimal = a + sumOfDecimals
print(sumIntAndDecimal)
# Arithmetic operations
a = 5 + 2
b = 10 - 2
c = a * b
d = c / 4
print(e)
while a < 10:
print(a)
a = a + 1
if a == 10:
print(z)
# For loop
for __index__ in range(0, 2):
print(f)
# If condition
if c > d:
print(c)
else:
print(d)
# String operations
# strVal = "Test"
# strVal2 = "another"
# strVal3 = strVal + strVal2
# print(strVal)
# print(strVal3)
# Concat
# strVal = "Test" + "another" + "Test"
# Function
# def add(x, y):
# return x + y
# result = add(5, 4)
# print("Result:", result)