-
Notifications
You must be signed in to change notification settings - Fork 1
/
12 exercises.py
62 lines (45 loc) · 1.29 KB
/
12 exercises.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
from unit_tester import test
import seqtools
import calendar
import math
import copy
cal = calendar.TextCalendar()
def test_suite():
test(exer_7(",", ";", "this,that,andsomeotherthing") ==
"this;that;andsomeotherthing")
test(exer_7(" ", "**", "Words will now be separated by stars.") ==
"Words**will**now**be**separated**by**stars.")
def exer_1():
cal.setfirstweekday(3)
# print(cal.pryear(2020))
cal.setfirstweekday(3)
print(cal.formatmonth(2020, 2))
# d = calendar.LocaleTextCalendar(6, "JAPANESE")
# d.pryear(2012)
def exer_2():
print("there are 55 math functions")
print("they do floor and ceiling division")
print("by doing the simple math that equates the same awnser")
print("the three are", "e,", "tau,", "pi,")
def exer_3():
x = 2
y = 5
c = copy.copy(x)
x = 3
c = copy.deepcopy(x)
x = 4
print(c)
def exer_6():
print("that they're a good a idea")
def exer_7(old, new, s):
""" Replace all occurrences of old with new in s. """
x = new.join(s.split(old))
return x
def exer_8():
print("string.punctuation is missing the punctuation ’ ")
print("it gave me a string like this:", "’now’", "rather than this:", "now")
exer_1()
# exer_2()
# exer_3()
# exer_8()
test_suite()