1
사용자가 지정한 길이로 피보나치 시퀀스를 생성하는 간단한 프로그램을 만들었습니다. 다음과 같이 내가 코드를 입력 6 같은 숫자를 실행하는 순간, 그것은 순서를 표시합니다 : 내가 제거하려면 어떻게피보나치 시퀀스 불일치
1, 1,2,3,5,8,
문자열이 한 줄에 머물러있는 동안 초기 공백은? 아래에있는 내 코드
#user intiger input
print("\n")
f = int(input("Enter length of sequence: "))
print("\n")
f1 = 1
f2 = 1
multiply = 2
if f <=0:
print("Enter a positive integer for the length: ")
elif f == 1:
print("The Fibonacci sequence: ")
print("\n")
print(f1,end=',')
else:
print("The Fibonacci sequence: ")
print(f1,",",f2,end=",")
while multiply < f:
f3 = f1 + f2
print(f3,end=",")
f1 = f2
f2 = f3
multiply += 1
print("\n")
나는 제목을 바꿀 것이다. fibonacci 시퀀스와는 아무런 관련이 없기 때문이다. 또한 사람들이 실제로 찾을 수 있도록 일부 태그를 추가하십시오. – Rvervuurt