/
program.txt
42 lines (33 loc) · 918 Bytes
/
program.txt
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
# A verbose program intended to showcase it's current features
# Type "python verbose.py program.txt" to run this program
say "Hello, World!" # Prints "Hello, World!"
# Prints firstName and lastName together
firstName is "Jane"
lastName is "Doe"
print "Full name: " + (firstName and lastName)
# Finds hypotenuse of a triangle
a = 3
b = 4
print "Hypotenuse = " + sqrt of (a square + b square)
# Proves a trignometric identity
angle = 20
print "sin^2 theta + cos^2 theta = " + (sin(angle)^2 + cos(angle)^2)
# Calculates and prints speed of light from predefined constants
print "Speed of light: " + 1 / sqrt($mu_0 * $epsilon_0)
# Calculates and prints mean
numbers are [1 2 3 4 5]
print "Mean: " + (mean of numbers)
num = 18
i = 1
num_factors = 0
while i < num {
if num % i == 0 {
increment num_factors
}
increment i
}
if num_factors > 1 {
print "Composite"
} else {
print "Prime"
}