PythonHolic
[python] 대수학자 minje-Kim이 만든 minjeK수열 문제 본문
def minje():
n1 = int(input(""))
n2 = int(input(""))
while True:
if n1 > n2:
print("n1은 항상 n2 보다 작아야 합니다 ")
n1 = int(input())
n2 = int(input())
else:
break
count = 0
a = []
a.append(n1)
while True:
if a[count] >= n1 and a[count] <= n2:
if a[count] > 0:
a.append(a[count]*2+1)
count +=1
elif a[count] <0:
a.append(a[count]**2)
count +=1
elif a[count] == 0:
a.append(a[count]+10)
count +=1
else:
break
del a[0]
if a[count-1] > n2:
del a[count-1]
print("\n[ 출 력 ]")
for i in range(len(a)):
print(a[i])
minje()
'파이썬 과제 도와주기 일지' 카테고리의 다른 글
[python] 민수의 마법 항아리 문제 (0) | 2020.06.25 |
---|---|
[python] 8명 학생에 대한 성적 관리 프로그램 (0) | 2020.06.25 |
[python] 리스트 안에 있는 단어중 가장 긴 단어와 짧은 단어 찾기 (1) | 2020.06.25 |
[python] txt 파일 내의 영어 알파벳 갯수 새기 (0) | 2020.06.25 |
[python] 주사위를 던져 높은숫자가 나온사람이 이기도록 하기 (0) | 2020.06.25 |
Comments