Skip to content

Instantly share code, notes, and snippets.

@buzibu
Created September 30, 2016 11:19
Show Gist options
  • Save buzibu/4f48ed2aa58ca6131e032b0fdf5f77ed to your computer and use it in GitHub Desktop.
Save buzibu/4f48ed2aa58ca6131e032b0fdf5f77ed to your computer and use it in GitHub Desktop.
# -*- 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