목록Def (2)
배워서? 남줘라!
파이썬 함수 (python function) #python7_function #1. (두 수 곱하는 함수 만들기) def multiply(a,b): result = a*b return result multiply(2,3) #2. (1부터 원하는 수까지 곱하는 함수 만들기) def multiply_many(*args): RESULT = 1 for i in args: RESULT =RESULT * i return RESULT multiply_many(1,2,3,4) #3. choice라는 매개변수를 이용해 더하거나 곱하는 함수 만들기 def addmulti(choice, *args): if choice == "add": result1 = 0 for i in args: result1=result1+i elif..
Translational Healthcare/Python
2022. 10. 14. 19:38
Python IDLE(Integrated Development and Learning Environment) 에디터 사용하기 1. 윈도우창에서 IDLE python 실행하면 shell 창이 켜진다. 2. File → New File 누르면 IDLE 에디터 창이 켜진다. 3. 에디터 창에 원하는 명령어 입력하고 [F5]로 실행 → Shell 창에 결과값이 나온다. 4. 처음 실행시킬 때에는 저장 알림이 뜨고 원하는 위치에 .py로 저장한다. # if a=5 if a>2: print('a is greater than 2') # for for a in [5,3,7]: print(a) # while a=0 while a
Translational Healthcare/Python
2022. 10. 4. 15:22