Skip to content

Commit b46279a

Browse files
committed
Merge pull request #7 from palcu/infoeducatie
Add help for string exercises
2 parents d18d7f2 + 2cae77a commit b46279a

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

string_help.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
x = "infoeducatie"
2+
3+
if x == "rosedu":
4+
print("miau miau")
5+
else:
6+
print("cutu cutu")
7+
8+
# >>> cutu cutu
9+
10+
x[0]
11+
12+
# >>> i
13+
14+
x[1]
15+
16+
# >>> n
17+
18+
x[-1]
19+
20+
# >>> e
21+
22+
x[-2]
23+
24+
# >>> i
25+
26+
x[3:]
27+
28+
# >>> oeducatie
29+
30+
x[4:-2]
31+
32+
# >>> educat
33+
34+
x.replace("e", "#")
35+
36+
# >>> info#ducati#
37+
38+
len(x)
39+
40+
# >>> 12
41+
42+
"educat" in x
43+
44+
# >>> True

0 commit comments

Comments
 (0)