Created
September 30, 2016 11:19
-
-
Save buzibu/4f48ed2aa58ca6131e032b0fdf5f77ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Fri Sep 30 12:48:00 2016 | |
@author: Vladislav.Zaimov | |
""" | |
lake_depth = 0 | |
lake_water = 0 | |
input_string = input("Input: ").lower() | |
for ch in input_string: | |
if ch == 'h': | |
if lake_depth > 0 : | |
lake_water += lake_depth | |
pass | |
elif ch == 'd': | |
if lake_depth >= 0 : | |
lake_water += lake_depth + 0.5 | |
lake_depth += 1 | |
pass | |
elif ch == 'u': | |
if lake_depth > 0 : | |
lake_water += lake_depth - 0.5 | |
lake_depth -= 1 | |
else: | |
print("Ingnoring invalid value: {}".format(ch)) | |
print(lake_water*1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment