how_many_legs should take a string which is the name of an a
来源:学生作业帮 编辑:大师作文网作业帮 分类:英语作业 时间:2024/11/12 05:40:28
how_many_legs should take a string which is the name of an animal and return a number representing how many legs the animal has.It needs to recognise at least the following animals:human,chicken,horse,dog,spider,centipede.If it is given an animal it does not recognise,it should print an error message and then return 0.
自己做的:
def how_many_legs(name):
if name == "horse" or "dog":
return "this animal have 4 legs"
if name == "chicken" or "human":
return "this animal have 2 legs"
if name == "spider":
return "this animal have 8 legs"
if name == "centipede":
return "this animal have 30 or 34 legs"
else:
return "error,0"
它就只会打"this animal have 4 legs",求更正,
自己做的:
def how_many_legs(name):
if name == "horse" or "dog":
return "this animal have 4 legs"
if name == "chicken" or "human":
return "this animal have 2 legs"
if name == "spider":
return "this animal have 8 legs"
if name == "centipede":
return "this animal have 30 or 34 legs"
else:
return "error,0"
它就只会打"this animal have 4 legs",求更正,
def how_many_legs(name):
if name == "horse" or name =="dog":
return "this animal have 4 legs"
if name == "chicken" or name =="human":
return "this animal have 2 legs"
if name == "spider":
return "this animal have 8 legs"
if name == "centipede":
return "this animal have 30 or 34 legs"
else:
return "error,0"
if name == "horse" or name =="dog":
return "this animal have 4 legs"
if name == "chicken" or name =="human":
return "this animal have 2 legs"
if name == "spider":
return "this animal have 8 legs"
if name == "centipede":
return "this animal have 30 or 34 legs"
else:
return "error,0"
how_many_legs should take a string which is the name of an a
Which of the following is a girl's name?
请问A:which of the three ways shall i take to the village?B:an
here are five girls names ,which one is not the name of a fl
Which name is a flower
__________ name of his bird is Polly.A.A B.An C.Its D.The
英语翻译panda is the name of an Asian animal.A panda is alarge,b
译中Libya and Gaddafi,which is a name of a person,and which is
Portsmouth is the name of a _____.
Australia is the name of a _____
Which of the following is not a component of an interest rat
Which of the following is correct?A.He is an English .B.He i