def test_countdown(self):
from_3 = '3\n2\n1\nBlastoff!'
self.assertEqual(countdown(3), from_3)
from_0 = 'Blastoff!'
self.assertEqual(countdown(0), from_0)
#THIS IS THE TEST
def countdown(n):
while n>0:
print(n)
n=n-1
print("Blastoff!")
#This is my code for the function
It is not passing the test because on the back end it is coming out as 'none' > for countdown(3) instead of '3\n2\n1\nBlastoff!'
您正在打印,而不是连接:
或如Lalaland建议的:
相关问题 更多 >
编程相关推荐