[Programming Fundamentals] 2.Fish Statistics
Здравейте, относно задача 2.Fish Statistics, дава ми само 40/100т. - https://pastebin.com/a7MTVxu9. Моля за малко съдействие.
You are a marine biologist tasked with researching various types of fish. You will receive a single line on the console as input. From this line, you must extract all the fish you find and print statistics about each one.
Fish are categorized by three criteria: tail length, body length and status. A standard fish looks like this:
><(((('> |
This fish has a tail length of 1, a body length of 4 and has the status “Awake”, since its eye is open. One ASCII character represents 2 centimeters in real life. By those standards, this fish has a tail length of 2 cm and a body length of 8 cm. There are various types of tails, bodies and statuses, which are described below:
- Tail types:
- Tail longer than 5 “<” characters à Long
- Tail longer than 1 “<” characters à Medium
- Tail, which is 1 “<” character long à Short
- Nonexistent tail à None
- Body types:
- Body longer than 10 “(” characters à Long
- Body longer than 5 “(” characters à Medium
- Any other length à Short
- Statuses:
- ' à Awake
- - à Asleep
- x à Dead
The input will contain a variable amount of fish, separated by any sequence of ASCII characters. There’s a possibility you might receive input, which has no fish – in this case, just print “No fish found.”, and end the program.
Examples
Input |
Output |
><(((('> >>>><((((((((('>~~~~~<((->~~~ o o >>>><((x> |
Fish 1: ><(((('> Tail type: Short (2 cm) Body type: Short (8 cm) Status: Awake Fish 2: >>>><((((((((('> Tail type: Medium (8 cm) Body type: Medium (18 cm) Status: Awake Fish 3: <((-> Tail type: None Body type: Short (4 cm) Status: Asleep Fish 4: >>>><((x> Tail type: Medium (8 cm) Body type: Short (4 cm) Status: Dead |
o oo >>>><((-> * ()()()(): |
Fish 1: >>>><((-> Tail type: Medium (8 cm) Body type: Short (4 cm) Status: Asleep |
o o ><(-> >><(('> <(((((((((x> * #%#$@ * |
Fish 1: ><(-> Tail type: Short (2 cm) Body type: Short (2 cm) Status: Asleep Fish 2: >><(('> Tail type: Medium (4 cm) Body type: Short (4 cm) Status: Awake Fish 3: <(((((((((x> Tail type: None Body type: Medium (18 cm) Status: Dead |
o xx xxxx ~ ~ ~ xxxx |
No fish found. |