Skip to content

Instantly share code, notes, and snippets.

@yunho0130
Created January 7, 2017 03:21
Show Gist options
  • Save yunho0130/184432ae5f1208e2c929570f6910e65e to your computer and use it in GitHub Desktop.
Save yunho0130/184432ae5f1208e2c929570f6910e65e to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 07 12:00:41 2017
@author: Yunho
"""
def plus(a,b):
print a+b
return a+b
def minus(a,b):
print a-b
return a-b
def main(a,b):
print '메인함수 입니다.'
print '계산기에 오신걸 환영합니다'
print '원하시는 계산을 선택하세요 1. 덧셈 2. 뺄셈'
operation_opt = int(raw_input('enter opt: '))
if operation_opt == 1:
return plus(a,b)
elif operation_opt == 2:
return minus(a,b)
else:
print '잘못된 값을 입력하셨습니다.'
# __시스템예약어__
if __name__ == '__main__':
while True:
a = int(raw_input('enter num1: '))
b = int(raw_input('enter num2: '))
main(a,b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment