0

hey can some one tell me how to print input of this question in a list ?

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 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. Objectives 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 habitats to print its content. End with the following phrase: camel = """ Switching on camera from habitat with camels... ___.-''''-. /___ @ | ',,,,. | _.'''''''._ ' | / \\ | \ _.-' \\ | '.-' '-. | ', | '', ',,-, ':; ',,| ;,, ,' ;; ! ; !'',,,',',,,,'! ; ;: : ; ! ! ! ! ; ; :; ; ; ! ! ! ! ; ; ;, ; ; ! ! ! ! ; ; ; ; ! ! ! ! ; ; ;,, !,! !,! ;,; /_I L_I L_I /_I Yey, our little camel is sunbathing!""" lion = """ Switching on camera from habitat with lions... ,w. ,YWMMw ,M , _.---.._ __..---._.'MMMMMw,wMWmW, _.-"" ''' YP"WMMMMMMMMMb, .-' __.' .' MMMMW^WMMMM; _, .'.-'"; `, /` .--"" :MMM[==MWMW^; ,mM^" ,-'.' / ; ; / , MMMMb_wMW" @\\ ,MM:. .'.-' .' ; `\ ; `, MMMMMMMW `"=./`-, WMMm__,-'.' / _.\ F'''-+,, ;_,_.dMMMMMMMM[,_ / `=_} "^MP__.-' ,-' _.--"" `-, ;

13th May 2020, 8:08 AM
Snehil Tripathi
Snehil Tripathi - avatar
1 Odpowiedź
+ 3
Might I suggest you use a dictionary instead of a list. Following snippet gives you an idea. cam = int(input()) enclosures ={ 1: 'Girraffe', 2: 'Lion', 3: 'Monkey', 4: 'Politician' } if cam in enclosures: print('Turn on',enclosures[cam],'camera')
13th May 2020, 9:32 AM
Rik Wittkopp
Rik Wittkopp - avatar