728x90
반응형
while 문
count = 5
while count >=0:
print(str(count)+"!")
count = count-1
for 문
count = [5,4,3,2,1]
for x in count:
print(str(x)+"!")
for 문(range 명령어)
count = range(10)
for n in count:
if(n+1)%3 == 0:
print("짝!")
else:
print(n+1)
for 문(break 명령어)
word = ["혼자","공부하는","첫","프로그래밍","!"]
for x in word:
if x == "첫":
print("첫 프로그래밍!")
break
print(x)
for 문(continue 명령어)
count = range(20)
for x in count:
if ((x+1)%10)!=0:
continue
print(str(x+1)+"!")
참고 사항
Shell에서 각 타입 알아볼 때 쓰는 방법
#type(shell에서 확인)
type("hello")
type(3)
type(3.)
type(true)
type([])
type(['hello'])
len([])
len(['hello'])
len({})
type({})
type({"종족":"혼공족"})
len({"종족":"혼공족"})
{"종족":"혼공족"}.keys()
{"종족":"혼공족"}.values()
{"종족":"혼공족"}.items()
type(range(30))
type(30).__class__
728x90
반응형
'즐거운프로그래밍' 카테고리의 다른 글
[파이썬] 데이터 세트와 for 반복문 활용하기 (0) | 2023.10.26 |
---|---|
[파이썬] 데이터 타입과 for 반복문 (0) | 2023.10.26 |
[파이썬] 반복문 : Range , Break, Continue 명령어 (0) | 2023.10.26 |
[파이썬] 반복문 : For~in 문(자바에 적용하기) (0) | 2023.10.26 |
[파이썬] 반복문 : For~in 반복문 예제 (0) | 2023.10.26 |