命令:>;>;>;pets=('dog','cat','bird','dog')>;>;>;pets.index('dog')执行结果为:
A: 0
B: 1
C: 2
D: 3
A: 0
B: 1
C: 2
D: 3
举一反三
- 已知pets = [‘ant’, ’dog’, ’cat’, ’bird’],要对该列表中的元素排序应该使用下列哪个方法? A: pets.sort( ) B: pets.reverse( ) C: pets.extend( ) D: pet.insert( )
- The frog found a ____, the cat found a ____, the bird found a ____ and the dog found a _____.
- (7-1)定义了Animal类、Cat类和Dog类,则()代码段是正确的。classAnimal{};classCatextendsAnimal{}classDogextendsAnimal{} A: Dog[] a = new Dog[5];a[0] = new Cat(); B: Animal a = new Animal[5];a[0] = new Animal(); C: Dog[]a = new Dog[5];a[0] = new Animal(); D: Cat[]a = new Cat[5];a[0] = new Cat();
- 在前面几题的基础上,有子类Dog和Cat继承了父类Animal,如下空格的输出是以下哪个选项?dog = Dog(coco,small); cat = Cat(kawaii)>>> isinstance(dog, Animal)___________>>> isinstance(cat, Animal)___________>>> isinstance(dog, Dog)___________>>> isinstance(dog, Cat)____________
- In terms of health, _______. A: leading a dog’s life is beneficial B: raising pets can do good to us C: leading a cat’s life is beneficial D: cats are more helpful