Skip to content
Snippets Groups Projects
Commit 565b49b1 authored by Mike Gerlach's avatar Mike Gerlach
Browse files

Upload New File

parent 27629d3e
No related branches found
No related tags found
No related merge requests found
# Programmieren 2 Praktikum 2/3 Gerlach, Mike (768100)
class Whisky(object):
def __init__(self, alc):
self.alc = alc
def alc(self, x):
self.alc += x
def minAlc(self, value):
if self.alc != None:
print("Wert darf nicht mehr geändert werden!")
elif value >= 40:
self.alc = value
else:
print("Alkoholgehalt: {} Vol.-% zu gering!".format(value))
def str(self):
print("Alkoholgehalt : {} Vol.-%".format(self.alc))
def main():
try:
glenmorangie18 = Whisky(alc=42)
glenmorangie18.minAlc(40)
glenmorangie18.str()
Whisky.alc(glenmorangie18, 1)
glenmorangie18.str()
except [ValueError] as vr:
print("Alkoholgehalt: {} Vol.-% zu gering!".format(*vr.args))
if __name__ == '__main__':
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment