< Kurs:Python < Material < Scripts
Lösung in Python für die Programmieraufgabe „Boolescher Ausdruck zur Definition einer Metropole“.
Script
stadt = raw_input ("Wie heisst ihre Stadt? ")
istHaupstadt = raw_input ("Ist Ihre Stadt eine Hauptstadt? (Ja, Nein) ")
anzahlEinwohner = input ("Wie viele Einwohner hat Ihre Stadt? ")
steuernProEinwohner = input ("Wie hoch ist die durchschnittliche monatliche Steuerabgabe pro Einwohner? ")
if istHaupstadt == "Ja" and anzahlEinwohner >= 100000 and steuernProEinwohner >= 720000000:
print stadt, "ist eine Metropole."
else:
print stadt, "ist eine schoene Stadt, aber keine Metropole."
This article is issued from Wikiversity. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.