@InformaticaH4/

Python-Periode4

Python

No description

fork
loading
Files
  • main.py
main.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
86
87
88
89
90
91
92
print("opdr 1")
print("""


""")
tekst = str(input("Geef een string:"))
i=0
lowerTekst = tekst.lower()
tekstEdit = lowerTekst+" "
while i < len(tekstEdit):
  while tekstEdit[i] == "a" or tekstEdit[i] == "e" or tekstEdit[i] == "i" or tekstEdit[i] == "o" or tekstEdit[i] == "u":
    print(tekst[i],"[",i,"]","[",-len(tekst) + i,"]", end="")
    print()
    i += 1 
  else:
    i += 1
print()
print("""


""")
print("opdr 2")
print("""


""")
i = 0
string1 = "The Holy Grail"
string2 = "Life of Brian"
while i < len(string2):
  if string1[i] == string2[i]:
    print(string1[i], i)
    i += 1
  else:
    i += 1
print("""


""")
print("opdr 3")
print("""


""")
def lettersString(string):
  nieuweString = ""
  lowerString = string.lower()
  for i in range(0, len(lowerString), 1):
    if lowerString[i] >= "a" and lowerString[i] <= "z":
      nieuweString += str(string[i])
    else:
      nieuweString+=" "
  return(str("\""+nieuweString+"\""))
opdr3input = str(input("geef een string:"))
print(lettersString(opdr3input))
print("""


""")
print("opdr 10.1")
print("""


""")
tekst = str(input("Geef een string:"))
i=0
aCount=0
eCount=0
iCount=0
oCount=0
uCount=0
lowerTekst = tekst.lower()
tekstEdit = lowerTekst+" "
while i < len(tekstEdit):
  if tekstEdit[i] == "a":
    aCount += 1
    i += 1
  elif tekstEdit[i] == "e":
    eCount += 1
    i += 1
  elif tekstEdit[i] == "i":
    iCount += 1
    i += 1
  elif tekstEdit[i] == "o":
    oCount += 1
    i += 1
  elif tekstEdit[i] == "u":
    uCount += 1
    i += 1
  else:
    i += 1
print("A =",aCount, "en E =",eCount, "en I =",iCount, "en O =",oCount, "en U =",uCount)