how_many_legsshouldtakeastringwhichisthenameofananimalandreturnanumberrepresentinghowmanylegstheanimalhas.Itneedstorecogniseatleastthefollowinganimals:human,chicken,horse,dog,spider,centipede.Ifitisgivenananimalitdoesnotrecognise,itshouldprintanerrormessageandthenreturn0.
自己做的:
defhow_many_legs(name):
ifname=="horse"or"dog":
return"thisanimalhave4legs"
ifname=="chicken"or"human":
return"thisanimalhave2legs"
ifname=="spider":
return"thisanimalhave8legs"
ifname=="centipede":
return"thisanimalhave30or34legs"
else:
return"error,0"
它就只会打"thisanimalhave4legs",求更正,