works:programmer:py:multiplie-arguments
Передача множественных аргументов в Python
class Hello: def __init__(self): self.name = "World" def sayHello(self, *names): if (len(names) == 0): print("Hello " + self.name) return for name in names: assert isinstance(name, str) print("Hello " + name) def setName(self, newName): assert isinstance(newName, (str, int)) self.name = str(newName) def getName(self): return self.name hello = Hello() hello.setName("EugeneX") hello.sayHello() hello.sayHello("Вася", "Петя")
works/programmer/py/multiplie-arguments.txt · Последнее изменение: 2020/08/24 07:21 — 127.0.0.1