Join JetBrains Academy from here
(Under Construction, Updating everday. Do visit again!)
- Easy
- Zookeeper
- Coffee Machine
- Credit Calculator
- Simple Chatty Bot
- Medium
- Hangman
- Tic-Tac-Toe
- Rock-paper-Scissors
- Numeric Matrix Processor
- Hard
- Smart Calculator
- Text-Based Browser
- Tic-tac-Toe With AI
- To-Do List
- Challenging
- Password Hacker
- HyperCar Service Center
- HyperJob Agency
- HyperNews Portal
This short code challenge can help the local zoo look after its denizens. You will create a tool for monitoring animals and their status.
This project is aimed at our beginners. It helps you understand some syntax basics and learn how to work with variables, data storage types such as lists, and while loops.
First, let's try to get some simple output from your code.
There are many animals in the zoo: all of them need care, and some of them are endangered and require preservation efforts. Animals must be fed, cleaned, surrounded by their kin, and kept happy. That is a difficult task for such a big open-range zoo, so one of your employers suggested a better way to accomplish that. She wants to be able to watch any animal on the screen with the help of a special program.
In this project, you will create a program that helps the zookeeper check on the animals and see that they're well. Your product will be able to understand commands from the zoo staff and show the animals on the monitor.
To begin with, you should develop a simple printer. Your program must show the text from the output example.
Output:
I do love animals!
Start looking after animals...
Deer looks fine.
Bat looks happy.
Lion looks healthy.
Show the zookeeper an image of her ward.
The important thing about working with animals is watching them. We need to see the animals on the screen to know how they are doing, right? At this time, we are ready to print something awesome: animal images!
In the second stage, you need to develop an animal printer. Your program should show a certain animal: you will find it in the code field.
Please, don't remove the r character at the start of the code template. It's a part of the string and it's important. So, the string should start with r""" sequence.
Your output should contain the following ASCII image:
Switching on camera from habitat with camels...
___.-''''-.
/___ @ |
',,,,. | _.'''''''._
' | / \
| \ _.-' \
| '.-' '-.
| ',
| '',
',,-, ':;
',,| ;,, ,' ;;
! ; !'',,,',',,,,'! ; ;:
: ; ! ! ! ! ; ; :;
; ; ! ! ! ! ; ; ;,
; ; ! ! ! ! ; ;
; ; ! ! ! ! ; ;
;,, !,! !,! ;,;
/_I L_I L_I /_I
Yey, our little camel is sunbathing!
The zookeeper wants to know what is inside each habitat, by its number.
The third stage brings new abilities for your software: it will be able to recognize the number of a specific habitat from the input and show the animals living there.
Add all variables with images from the template to a variable with the type list. The order of variables matters: they must be in the order they're defined in the code. The list must contain all of them with no duplicates.
In this stage, your program should:
Ask for a number of the habitat using the following phrase: Which habitat # do you need?.
Use the input number as an index of your habitat to print its content.
End with the following phrase:
The end of the program. To check another habitat restart the watcher please.
The greater-than symbol followed by a space (> ) represents the user input. Notice that it's not part of the input.
Which habitat # do you need? > 5
Switching on camera from the habitat with rabbits...
,
/| __
/ | ,-~ /
Y :| // /
| jj /( .^
>-"~"-v"
/ Y
jo o |
( ~T~ j
>._-' _./
/ "~" |
Y _, |
/| ;-"~ _ l
/ l/ ,-"~ \
\//\/ .- \
Y / Y
l I !
]\ _\ /"\
(" ~----( ~ Y. )
It seems there will be more rabbits soon!
The end of the program. To check another habitat restart the watcher please.
Which habitat # do you need? > 4
Switching on camera from the habitat with bats...
_________________ _________________
~-. \ |\___/| / .-~
~-. \ / o o \ / .-~
> \\ W // <
/ /~---~\ \
/_ | | _\
~-. | | .-~
; \ / i
/___ /\ /\ ___\
~-. / \_/ \ .-~
V V
It looks like this bat is fine.
---
The end of the program. To check another habitat restart the watcher please.
Finally, your program is able to work for as long as needed!
It's time to make your project more convenient and understandable. In this final stage, your software will be ready for use by the zoo staff. Your program should understand the habitat numbers, show the animals, and be able to work infinitely.
These are your tasks at this point:
Your program should repeat the behavior from the previous stage, now in a loop
Do not forget to add an exit opportunity for the program: inputting the word exit must terminate the program.
At the end of execution, it must print See you!.
The greater-than symbol followed by a space (> ) represents the user input. Notice that it's not part of the input.
The complete program should work this way:
Which habitat # do you need? > 3
Switching on camera from the habitat with a lovely goose...
_
,-"" "".
,' ____ `.
,' ,' `. `._
(`. _..--.._ ,' ,' \ \
(`-.\ .-"" ""' / ( d _b
(`._ `-"" ,._ ( `-( \
<_ ` ( <`< \ `-._\
<`- (__< < :
(__ (_<_< ;
`------------------------------------------
This bird stares intently at you... (Maybe it's time to change the channel?)
> Which habitat # do you need? > 1
Switching on camera from the habitat with lions...
,w.
,YWMMw ,M ,
_.---.._ __..---._.'MMMMMw,wMWmW,
_.-"" ''' YP"WMMMMMMMMMb,
.-' __.' .' MMMMW^WMMMM;
_, .'.-'"; `, /` .--"" :MMM[==MWMW^;
,mM^" ,-'.' / ; ; / , MMMMb_wMW" @\
,MM:. .'.-' .' ; `\ ; `, MMMMMMMW `"=./`-,
WMMm__,-'.' / _.\ F'''-+,, ;_,_.dMMMMMMMM[,_ / `=_}
"^MP__.-' ,-' _.--"" `-, ; \ ; ;MMMMMMMMMMW^``; __|
/ .' ; ; ) )`{ \ `"^W^`, \ :
/ .' / ( .' / Ww._ `. `"
/ Y, `, `-,=,_{ ; MMMP`""-, `-._.-,
(--, ) `,_ / `) \/"") ^" `-, -;"\:
The lion is croaking!
Which habitat # do you need? > exit
See you!
What can be better than a cup of coffee during a break? A coffee that you don’t have to make yourself. It’s enough to press a couple of buttons on the machine and you get a cup of energy; but first, we should teach the machine how to do it. In this project, you will work on programming a coffee machine simulator. The machine works with typical products: coffee, milk, sugar, and plastic cups; if it runs out of something, it shows a notification. You can get three types of coffee: espresso, cappuccino, and latte. Since nothing’s for free, it also collects the money.
This project allows you to get a taste of Python. Practice working with functions, challenge yourself with loops and conditions, and get more confident in Python.