Skip to content

Commit 55e8eb1

Browse files
authored
Add files via upload
1 parent d2a109d commit 55e8eb1

7 files changed

+58
-0
lines changed

Gauss_example.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
total = 0
2+
for num in range(101):
3+
total = total + num
4+
print(total)

exitExample.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import sys
2+
3+
while True:
4+
print('Type exit to exit.')
5+
response = input()
6+
if response == 'exit':
7+
sys.exit()
8+
print('You typed ' + response + '.')

fiveTimesV2.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
print('My name is')
2+
i = 0
3+
while i < 5:
4+
print('Jimmy Five Times (' + str(i) + ')')
5+
i = i + 1

helloFunc.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def hello():
2+
print('Howdy!')
3+
print('Howdy!!!')
4+
print('Hello there.')
5+
hello()
6+
hello()
7+
hello()

helloFunc2.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def hello(name):
2+
print('Hello ' + name)
3+
4+
hello('Alice')
5+
hello('Bob')

magic8Ball.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import random
2+
def getAnswer(answerNumber):
3+
if answerNumber == 1:
4+
return 'It is certain'
5+
elif answerNumber == 2:
6+
return 'It is decidedly so'
7+
elif answerNumber == 3:
8+
return 'Yes'
9+
elif answerNumber == 4:
10+
return 'Reply hazy try again'
11+
elif answerNumber == 5:
12+
return 'Ask again later'
13+
elif answerNumber == 6:
14+
return 'Concentrate and ask again'
15+
elif answerNumber == 7:
16+
return 'My reply is no'
17+
elif answerNumber == 8:
18+
return 'Outlook not so good'
19+
elif answerNumber == 9:
20+
return 'Very doubtful'
21+
22+
r = random.randint(1,9)
23+
fortune = getAnswer(r)
24+
print(fortune)
25+
26+

printRandom.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import random
2+
for i in range(5):
3+
print(random.randint(1, 10))

0 commit comments

Comments
 (0)