W6-C1 作业

11-1
def printnames(city,country):
	return city.title()+","+country.title()
import unittest
from hello_world import printnames

class PrintTestCase(unittest.TestCase):
	def test_print(self):
		answer=printnames("beijing","china")
		self.assertEqual(answer,"Beijing,China")

unittest.main()


11-2
def printnames(city,country,population):
	return city.title()+","+country.title()+"-"+str(population)
import unittest
from hello_world import printnames

class PrintTestCase(unittest.TestCase):
	def test_print(self):
		answer=printnames("santiago","chile",5000000)
		self.assertEqual(answer,"Santiago,Chile-5000000")

unittest.main()

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试