-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyscript.py
More file actions
77 lines (53 loc) · 1.59 KB
/
Copy pathmyscript.py
File metadata and controls
77 lines (53 loc) · 1.59 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
def main():
### Hello, World! ###
# print("Hello, World!")
### functions ###
# def main():
# print('This line is printed directly from the main function of the program')
# secondary_function()
# def secondary_function():
# print('This line is printed from a secondary function call within the main function')
### input / output ###
# name = input('What is your name?')
# print('Very nice to meet you,', name,'!')
# print(f'Have a great day, {name.upper()}!')
# print('See you soon, {}!'.format(name))
### type conversion ###
# int_value = 4
# print(int_value)
# print(type(int_value))
# print()
# float_value = float(int_value)
# print(float_value)
# print(type(float_value))
### boolean values ###
# x = 3
# y = 4
# result1 = 1 < x and y > 1
# result2 = x > 5 or y <= 3
# result3 = not (x > 2 and y > 1)
# print(result1)
# print(result2)
# print(result3)
### if statements ###
# score = input('What is your score? :')
# score = int(score)
# if score >= 92:
# print('Your final grade is an A')
# elif score >= 85:
# print('Your final grade is a B')
# elif score >= 70:
# print('Your final grade is a C')
# else:
# print('Talk with your instructor about your grade!')
nums = [3, 4, 16]
print('This is an example of for loops')
for num in nums:
print(num ** 2)
# while loop
i = 3
while i < 258:
print(i)
i = i ** 2
if __name__ == '__main__':
main()