Home Article Practice animal_farm.py

animal_farm.py

2022-04-28 15:02  views:343  source:小键人5671887    

"""Our own little animal farm."""
import sys
def add_animal(farm, animal):
farm.add(animal)
return farm
def main(animals):
farm = set()
for animal in animals:
farm = add_animal(farm, animal)
print("We've got some animals on the farm:", ','.join(farm) + '.')
if __name__ == '__main__':
if len(sys.argv)==1:
print('Pass at least one animal type!')
sys.exit(1)
main(sys.argv[1:])



Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)