-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasics.py
More file actions
62 lines (43 loc) · 1.07 KB
/
basics.py
File metadata and controls
62 lines (43 loc) · 1.07 KB
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
#!/usr/bin/python
# Interactive mode
# Type python
# Or for it to run a command and exit use python -c "code to run" like the examples below;
python -c "print 5+5"
python -c "print 5+5, 'hello'"
python -c "name = 'Meir'; print 5+5, 'hello', name"
print "Mary had a little lamb."
print "Its fleece was white as %s." % "snow"
print "And everywhere that Mary went."
print "wander..." * 10 # what'd that do?
end1 = "G"
end2 = "r"
end3 = "i"
end4 = "l"
end5 = "l"
end6 = "e"
end7 = "d"
end8 = "B"
end9 = "u"
end10 = "r"
end11 = "g"
end12 = "e"
end13 = "r"
i = 0
while i < 10:
print "wander..." * 5 # print the word wander out 5x
print "Hope he is not lost..."
i = i + 1 # Increment variable i each cycle by 1
print end1 + end2 + end3 + end4 + end5 + end6 + end7,
print end8 + end9 + end10 + end11 + end12 + end13
# prints variables end1 - end13 together without spaces.
var3 = 5 / 15 # 5 divided into 15
var4 = 10 ** 2 # 10 to the power of 2
""" These triple quotes allow
for multiple line comments
pretty neat huh?
"""
# Basic math
print 1+1
print 1*3
print 4/2
print 4**3