- 1
a=(lambda x:x*(x+1))_ print(a) How do I call 6 to the above code?
10 Réponses
+ 1
The 6 just needs to be placed into brackets
a=(lambda x:x*(x+1))(6)
print(a)
0
Fill in the blanks to take the numbers from the list while they are even, using the takewhile function.
from itertools
takewhile
nums = [2, 4, 6, 7, 9, 8]
a =
(
x: x%2==0, nums)
print(list(a))
- 1
class Student
def __init__(self, name):
self.name = name
sayHi(
):
print("Hi from "+
.name)
s1 = Student("Amy")
s1.sayHi()
- 1
Fill in the blanks to create a class with a method sayHi().
class Student
:
def __init__(self, name):
self.name = name
def
sayHi(
self
):
print("Hi from "+
self
.name)
s1 = Student("Amy")
s1.sayHi()
- 1
import
takewhile
lambda
- 1
Thanks all
- 1
class Student:
def __init__(self, name):
self.name = name
def sayHi(self):
print("Hi from "+self.name)
s1 = Student("Amy")
s1.sayHi()
- 1
class Student
:
def __init__(self, name):
self.name = name
def
sayHi(
self
):
print("Hi from "+
self
.name)
s1 = Student("Amy")
s1.sayHi()
- 2
Fill in the blanks to create a class with a method sayHi().
class Student
:
def __init__(self, name):
self.name = name
def
sayHi(
self
):
print("Hi from "+
self
.name)
s1 = Student("Amy")
s1.sayHi()
- 3
put (6) in place of underscore