python函数、斐波那契数列、列表排序

# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.
    poem = '''清晨的阳光,照亮了大地
    春日的气息,满溢着天地
    仿佛一切都在呼唤着
    那个踏实的早晨
    
    晨光渐明,自然的节拍
    生命与世界细细浸染
    宁静凝聚,淡定的心情
    期待早已铭刻的翅膀
    
    小鸟起舞,花儿吐艳
    沉静的风,轻轻的吹过
    新的一天,在这样的氛围中
    徐徐展开,美好的未来
    
    愿我们保持清醒的头脑
    拥有满怀激情的精神
    在早晨的光芒中起航
    把自己的梦想驶向未来'''
    print(poem)
def fibnachii():
    n = int(input("Enter the number of terms: "))

    # First two terms of the series
    a = 0
    b = 1

    # Check if input is valid
    if n <= 0:
        print("Please enter a positive integer")
    elif n == 1:
        print("Fibonacci sequence upto", n, ":")
        print(a)
    else:
        print("Fibonacci sequence:")
        for i in range(n):
            print(a,end=" ")
            c = a + b
            # Update values
            a = b
            b = c

def quick_sort(arr):
    if len(arr) < 2:
        return arr
    pivot = arr[0]
    less = [x for x in arr[1:] if x <= pivot]
    greater = [x for x in arr[1:] if x > pivot]
    return quick_sort(less) + [pivot] + quick_sort(greater)

arr = [4, 2, 7, 1, 3, 5, 6]

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')
    fibnachii()
    print(f"\nQuick sort method {arr}\n The Result:")
    print(quick_sort(arr))
# See PyCharm help at https://www.jetbrains.com/help/pycharm/