Python :: Aufgabe #16 :: Lösung #2
10 Lösungen

#16
Vokale zählen in einem beliebigen Satz
Anfänger - Python
von Dome
- 28.12.2012 um 23:58 Uhr
Programmieren Sie ein Programm, welches die Anzahl aller Vokale in einem zuvor eingegebenen Satz ausgibt.
Optional wäre die Ausgabe wie oft welcher Vokal in dem Satz vorhanden ist.
Optional wäre die Ausgabe wie oft welcher Vokal in dem Satz vorhanden ist.
Konsolenausgabe:
Geben Sie einen Satz ein :
Dies ist ein toller Satz.
Anzahl der Vokale : 8
A: 1
E: 3
I: 3
O: 1
U: 0
#2

von jigga (4260 Punkte)
- 18.05.2015 um 00:16 Uhr

string = input("Satz eingeben: ") klein = string.lower() anzahl = klein.count('a') + klein.count('e') + klein.count('i') + klein.count('o') + klein.count('u') print() print("Anzahl der Vokale:",anzahl) print() print("A:",klein.count('a')) print("E:",klein.count('e')) print("I:",klein.count('i')) print("O:",klein.count('o')) print("U:",klein.count('u'))
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1