-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpythonbasics.py
85 lines (41 loc) · 930 Bytes
/
pythonbasics.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
print("Hello, World!")
print(42 + 7)
print("42 + 7 = ", 24 + 7)
def hi():
print("Hi")
print("Have a nice afternoon!")
hi()
def hello(personName):
print("Hi", personName)
print("How are you today?")
hello("AJ")
hello("Alicia")
print()
#this will cause an error
hello
print
<built-in function print>
>>>
#hello.py
def main():
#get user input
personName = input("Enter your name ")
print("Hello,",personName,"How are you?")
main()
#hello1.py
def hello(personName):
print("Hello,",personName,"How are you?")
def main():
#get user input
person = input("Enter your name ")
hello(person)
main()
#range function examples
for i in range(7):
print(i)
for i in range(2, 7):
print(i)
for odd in range(1, 10, 2):
print(odd)
for even in range(2, 11, 2):
print(even)