aboutsummaryrefslogtreecommitdiff
path: root/Python/Beginner training/002 Pets.py
diff options
context:
space:
mode:
authorSyndamia <kami02882@gmail.com>2019-06-30 15:05:38 +0300
committerSyndamia <kami02882@gmail.com>2019-06-30 15:05:38 +0300
commita0addea2b7bbdac244420ec917c0f3c14c4c8831 (patch)
treea05310b0033f995dfd31b5795e7675aa382a18f3 /Python/Beginner training/002 Pets.py
parent0c7164435abda2e497957e195e6653f94f20135d (diff)
downloadSelf-learning-a0addea2b7bbdac244420ec917c0f3c14c4c8831.tar
Self-learning-a0addea2b7bbdac244420ec917c0f3c14c4c8831.tar.gz
Self-learning-a0addea2b7bbdac244420ec917c0f3c14c4c8831.zip
Added some of the stuff I have done while learning Python
Diffstat (limited to 'Python/Beginner training/002 Pets.py')
-rw-r--r--Python/Beginner training/002 Pets.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Python/Beginner training/002 Pets.py b/Python/Beginner training/002 Pets.py
new file mode 100644
index 0000000..bdc5a3b
--- /dev/null
+++ b/Python/Beginner training/002 Pets.py
@@ -0,0 +1,18 @@
+import sys
+import os
+import math
+
+days_absent = int(input('Type the number of days that you wil be absent: '))
+left_food_kg = float(input('Type the number of left food in kg: '))
+daily_consumption_first = float(input('Type the daily consumption of the first cat in kg: '))
+daily_consumption_second = float(input('Type the daily consumption of the second cat in kg: '))
+
+left_food_kg -= days_absent * daily_consumption_first
+left_food_kg -= days_absent * daily_consumption_second
+
+if left_food_kg >= 0:
+ print('The cats are well fed')
+ print('{} kilos of food left'.format(left_food_kg))
+else:
+ print('The cats are hungry')
+ print('{} more kilos of food are needed'.format(int(abs(left_food_kg)))) \ No newline at end of file