aboutsummaryrefslogtreecommitdiff
path: root/challenge-103/paulo-custodio/python/ch-1.py
diff options
context:
space:
mode:
author冯昶 <seaker@qq.com>2021-03-15 18:18:09 +0800
committer冯昶 <seaker@qq.com>2021-03-15 18:18:09 +0800
commit5ed25077fde85262036c9db3e893d70ae0907b5c (patch)
tree8932d25b3fa6076e2d91ab2a331d4d8bfff20544 /challenge-103/paulo-custodio/python/ch-1.py
parent8b6be37fe4dac8b4c6489a95e55514b76b298d15 (diff)
parent65d54d52500028ec5359a7d39619803ade281543 (diff)
downloadperlweeklychallenge-club-5ed25077fde85262036c9db3e893d70ae0907b5c.tar.gz
perlweeklychallenge-club-5ed25077fde85262036c9db3e893d70ae0907b5c.tar.bz2
perlweeklychallenge-club-5ed25077fde85262036c9db3e893d70ae0907b5c.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-103/paulo-custodio/python/ch-1.py')
-rw-r--r--challenge-103/paulo-custodio/python/ch-1.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/challenge-103/paulo-custodio/python/ch-1.py b/challenge-103/paulo-custodio/python/ch-1.py
new file mode 100644
index 0000000000..4eed2f269d
--- /dev/null
+++ b/challenge-103/paulo-custodio/python/ch-1.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+# Challenge 103
+#
+# TASK #1 > Chinese Zodiac
+# Submitted by: Mohammad S Anwar
+# You are given a year $year.
+#
+# Write a script to determine the Chinese Zodiac for the given year $year.
+# Please check out wikipage for more information about it.
+#
+# The animal cycle: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey,
+# Rooster, Dog, Pig.
+# The element cycle: Wood, Fire, Earth, Metal, Water.
+#
+# Example 1:
+# Input: 2017
+# Output: Fire Rooster
+# Example 2:
+# Input: 1938
+# Output: Earth Tiger
+
+import sys;
+
+animals = ['Rat','Ox','Tiger','Rabbit','Dragon','Snake','Horse','Goat',
+ 'Monkey','Rooster','Dog','Pig']
+elements = ['Wood','Wood','Fire','Fire','Earth','Earth','Metal','Metal',
+ 'Water','Water'];
+
+year = int(sys.argv[1])
+num_years = year-1924;
+element = num_years % len(elements);
+animal = num_years % len(animals);
+
+print(elements[element]," ",animals[animal]);