본문 바로가기

Common /Python24

[Python]자주 쓰이는 내장함수 - format format 코드 member = 314 greeting = '안녕하세요' place = '파이썬 월드' welcome = '환영합니다' #print함수만을 사용한 방식 print(member, greeting, ',', place, '에 오신 것을', welcome, '!') #format함수를 사용한 방식 origin = '{} {}, {}에 오신 것을 {}!' new = origin.format(member, greeting, place, welcome) print(origin) print(new) 결과314 안녕하세요 , 파이썬 월드 에 오신 것을 환영합니다 !{} {}, {}에 오신 것을 {}!314 안녕하세요, 파이썬 월드에 오신 것을 환영합니다! 2017. 6. 6.
[Python]Function #1 - 정의, 사용, 매개변수, 값반환 함수 정의 1. 함수 정의 명령어 - def def f_root(): r1 = (-b + (b ** 2 - 4 * a * c) ** 0.5) / (2 * a) r2 = (-b - (b ** 2 - 4 * a * c) ** 0.5) / (2 * a) print('The value is {} or {}'.format(r1, r2)) 2. 함수의 사용 def f_root(): r1 = (-b + (b ** 2 - 4 * a * c) ** 0.5) / (2 * a) r2 = (-b - (b ** 2 - 4 * a * c) ** 0.5) / (2 * a) print('값은 {} 또는 {}'.format(r1, r2)) a=2b=4c=-16 f_root() - 결과The value is 2.0 or -4.0 3. .. 2017. 6. 3.
[Python]편집기 설치-PyCharm Python 편집기 파이참(PyCharm) 설치 PyCharm 공식 내려받기 웹 페이지 - https://www.jetbrains.com/pycharm/download/ - Community Version Download PyCharm 실행 화면 2017. 6. 3.
[Python]3.6.1 설치 Python(3.6.1) 설치 1. Python Download Web Site https://www.python.org 2. Download File Install Install시 'Add Python 3.6 to PATH' Check 3. 설치 확인 - MAC 터미널 실행 후 DevInside-MacBookui-MacBook-Pro:~ DevInside$python↵ - Windows Cmd 창 실행 후 C:\사용자경로>python↵ * macOS에서 python으로 python3 실행하기 : python3을 모두 입력하기 귀찮으면 다음과 같이 python만 입력해도 되도록 설정을 변경 할 수 있다. ① 터미널에서 open -a TextEdit ~/.bash_profile을 입력 ② 편집기가 뜨면 맨.. 2017. 6. 3.