ekc1467 / big-data

0 stars 0 forks source link

Python practice #1

Open ekc1467 opened 4 years ago

ekc1467 commented 4 years ago

Python practice.zip

ekc1467 commented 4 years ago

Basic types a =3 b = 3.14 c = True #T는 대문자 type(a), type(b), type(c) #print 모듈을 사용하지 않고 한번에 출력하려면 한줄 쓰기 built-in functions 3 is not 4 <>:1: SyntaxWarning: "is not" with a literal. Did you mean "!="? <>:1: SyntaxWarning: "is not" with a literal. Did you mean "!="?

:1: SyntaxWarning: "is not" with a literal. Did you mean "!="? 3 is not 4 True a is 3, a > 2 <>:1: SyntaxWarning: "is" with a literal. Did you mean "=="? <>:1: SyntaxWarning: "is" with a literal. Did you mean "=="? :1: SyntaxWarning: "is" with a literal. Did you mean "=="? a is 3, a > 2 (True, True) Container types 5/2, 3//2, 3%2 (2.5, 1, 1) True + 1 2 a, b = 1e6, 1e-3 print(a, b) print(a + b) 1000000.0 0.001 1000000.001 c= 1.5 + 0.5j c, type(c), c.real, c.imag, c.conjugate() #real 실수부, imag 허수부 conjugate 켤레 복소수 ((1.5+0.5j), complex, 1.5, 0.5, (1.5-0.5j)) x = input ('파이썬 프로그래밍!') 파이썬 프로그래밍!굳 x '굳' type(x) str x = input('숫자 기입') 숫자 기입7 type(x) str s ="hellp" type(s) str s.capitalize(), s.upper(), s.lower(), s.swapcase(), s.title() ('Hellp', 'HELLP', 'hellp', 'HELLP', 'Hellp') s.isalpha(), s.isdigit(), s.isupper() #순서대로 문자인지 문자가 숫자인지 대문자인지.배열로 하나하나 확인도 가능하다. (True, False, False) s1 = "animals is cuty!" s2 = "is" s1.find(s2), s1.rfind(s2) #문자열 함수 왼쪽부터 찾기 오른쪽 부터 찾기 (8, 8) ​