Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- useState
- React
- plot in r
- setstate
- await
- 백준 11718
- R데이터형태
- DataFrame
- R 그래프
- 그대로 출력하기
- 광명시버스분석
- 값삭제
- getline
- 버스분석
- 이용현황분석
- react #회원가입 #비밀번호비교
- 데이터분석
- 백준 10172
- barplot
- 백준
- asynchronization
- barplot in r
- 배열추가
- 탈출문자
- vetor
- 배열삭제
- 그래픽
- 값추가
- 10172
- 이스케이프시퀀스
Archives
- Today
- Total
devlog_zz
python 기초 문법 본문
728x90
python
출력
print('Hello World')
입력
.split() , .split(',')
name = input('이름을 입력해주세요 :')
print(name)
num = int(input()) # 숫자를 입력받을 땐 int()를 활용해 string to int 형변환
print(num)
a,b = int(input().split())
print(a,b)
# split() 함수를 활용해 띄어쓰기를 통해 연속 입력 받을 수 있음
변수
따로 타입을 지정할 필요가 없다.
and or 문법
name = 'Kim'
print(name)
num = 10
num += 2
print(num)
# 참, 거짓
print(0 and 8)
# 0
print(False and True)
# False
print(True or False)
# True
조건문 ( if, else, elif )
tmp =2
if (tmp == 1):
print('I Am True')
else:
print('I am False')
# I am False
배열, range, len
arr = ['3424',1,'string']
print(arr.append('7777'))
# ['3424',1,'string','7777']
test = ['mon','tue','wed','thi','fri','sat','sun']
print(len(test))
# 7
print(test[3:6]) # test[3]~test[5]
#['thi', 'fri', 'sat']
for i in range(len(test)):
print(i)
print(test[i])
# 0
# mon
# 1
# tue
# 2
# wed
# 3
# thi
# 4
# fri
# 5
# sat
# 6
# sun
반복문 ( for, while )
for x in arr:
print(x)
# 3424
# 1
# string
num = 5
while(num):
print(num)
num -= 1
# 5
# 4
# 3
# 2
# 1
함수
def func (a):
return a+' is Happy'
print(func('Jack'))
dictionary
dic = {'Jack':25,'Amy':23,'Jenny':20}
print(dic['Jenny'])
# 20
728x90
'Back End > python' 카테고리의 다른 글
[python] Counter list 원소 개수 세기 (0) | 2022.08.07 |
---|---|
[python] set - list 중복 제거 (0) | 2022.08.07 |
[python] enumerate 함수 (0) | 2022.08.07 |
[python] list 길이 (0) | 2022.08.07 |
[python] list의 특정 값의 위치 (0) | 2022.08.07 |
Comments