-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlecture 1
42 lines (34 loc) · 1.21 KB
/
lecture 1
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
pi = 3.14159
radius = 2.2
# area of circle equation <- this is a comment
area = pi*(radius**2)
print(area)
# change values of radius <- another comment
# use comments to help others understand what you are doing in code
radius = radius + 1
print(area) # area doesn't change
area = pi*(radius**2)
print(area)
#############################
#### COMMENTING LINES #######
#############################
# to comment MANY lines at a time, highlight all of them then CTRL+1
# do CTRL+1 again to uncomment them
# try it on the next few lines below!
#area = pi*(radius**2)
#print(area)
#radius = radius + 1
#area = pi*(radius**2)
#print(area)
#############################
#### AUTOCOMPLETE #######
#############################
# Spyder can autocomplete names for you
# start typing a variable name defined in your program and hit tab
# before you finish typing -- try it below
# define a variable
a_very_long_variable_name_dont_name_them_this_long_pls = 0
# below, start typing a_ve then hit tab... cool, right!
# use autocomplete to change the value of that variable to 1
# use autocomplete to write a line that prints the value of that long variable
# notice that Spyder also automatically adds the closed parentheses for you!