如何将此伪代码转换为提款机上的Python程序?你知道吗
OUTPUT “Menu”
OUTPUT “1 – Cash withdrawal”
OUTPUT “2 – Balance”
OUTPUT “3 – PIN Services”
OUTPUT “4 – Pay bills”
OUTPUT “5 – Cancel”
OUTPUT “Please select an option 1-5:”
user_option ← USERINPUT
IF user_option = 1 THEN
proc_withdrawal()
ELSEIF user_option = 2 THEN
proc_balance()
ELSEIF user_option = 3 THEN
proc_pin()
ELSEIF user_option = 2 THEN
proc_bills()
ELSEIF user_option = 2 THEN
proc_cancel()
ELSE
OUTPUT “Please only enter an option 1, 2, 3, 4 or 5”
ENDIF
尝试类似这样的操作注意psudeo代码和实际代码之间的差异,因为您希望将用户输入与数字进行比较,所以需要将字符串输入转换为int:
用法示例:
相关问题 更多 >
编程相关推荐