Python :: Aufgabe #16 :: Lösung #9
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
#9

von Sleepyy (320 Punkte)
- 27.08.2020 um 12:24 Uhr

# -*- coding: utf-8 -*- """ Created on Thu Aug 27 12:05:20 2020 @author: Robin """ inp=0 while not inp: try: wort = str(input(">>> Bitte ein Wort eingeben: ")) inp = 1 except: print("") print(">>> Bitte nur Buchstaben eingeben !!!") a = wort.count("a") e = wort.count("e") i = wort.count("i") o = wort.count("o") u = wort.count("u") zusammen = a+e+i+o+u print("") print(">>> Dies ist ein toller Satz.") print("") print(">>> Anzahl der Vokale:",zusammen) print("") print(">>> A:",a) print(">>> E:",e) print(">>> I:",i) print(">>> O:",o) print(">>> U:",u)
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1