日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python中主函数循环,带有菜单函数的Python主函数循环不起作用?

發布時間:2023/12/10 python 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python中主函数循环,带有菜单函数的Python主函数循环不起作用? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我現在是一名大學生,正在上python課程。我們的任務是用函數創建這個程序。main函數調用菜單,然后在main函數中編寫一個循環,根據菜單函數中的用戶響應訪問其他函數。在

我好像不能讓我的循環工作。當我選擇一個菜單選項時,什么都不會發生。現在,我只有print語句來測試函數的調用。在我編寫函數之前,我要確保它能正常工作。在

如果有人有一個循環調用函數應該是什么樣的示例,這將對我有很大幫助。在def GetChoice():

#Function to present the user menu and get their choice

#local variables

UserChoice = str()

#Display menu and get choice

print()

print("Select one of the options listed below: ")

print("\tP\t==\tPrint Data")

print("\tA\t==\tGet Averages")

print("\tAZ\t==\tAverage Per Zone")

print("\tAL\t==\tAbove Levels by Zone")

print("\tBL\t==\tBelow Levels")

print("\tQ\t==\tQuit")

print()

UserChoice = input("Enter choice: ")

print()

UserChoice = UserChoice.upper()

return UserChoice

def PrintData():

print("test, test, test")

def AverageLevels():

print("test, test, test")

def AveragePerZone():

print("test, test, test")

def AboveLevels():

print("test, test, test")

def BelowLevels():

print("test, test, test")

def main():

Choice = str()

#call GetChoice function

GetChoice()

#Loop until user quits

if Choice == 'P':

PrintData()

elif Choice == 'A':

AverageLevels()

elif Choice == 'AZ':

AveragePerZone()

elif Choice == 'AL':

AboveLevels()

elif Choice == 'BL':

BelowLevels()

main()

總結

以上是生活随笔為你收集整理的python中主函数循环,带有菜单函数的Python主函数循环不起作用?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。