You make me want to become a better person :D

IT상식/파이썬

파이썬(python) 함수 연습문제

Hhwang 2021. 4. 26. 19:42
반응형

2 * 1 = 2
2 * 2 = 4
…        
9 * 9 = 81
>>> i = 1
>>> while i <= 9:
...   print (2, ' * ', i, ' = ', 2 * i)
...   i = i + 1
...
>>> def multi(a):
...   i = 1
...   while i <= 9:
...     print (a, ' * ', i, ' = ', a * i)
...     i = i + 1
...
>>> multi( 3 )
반응형