如何解决使用 Mojolicious::Lite (perl) - 我想将所有 PARAMS 列表放入一个简单的 @ARRAY
https://
get 'getparam' => sub {
my $c = shift;
print $c->param('h1') . "\n"; # THIS WORKS AS I WOULD EXPECT
my @list_of_all_params = $c->param; # DOES NOT WORK and THIS IS WHAT I WOULD LIKE TO MAKE WORK
return 1;
};
所以我真正想要的是@list_of_all_params 包含“h1”和“h2”,这是传递的参数
使用:https://
提前感谢大家!
解决方法
也许
import random
import time
def add(x,y):
return x + y
def sub(x,y):
return x - y
def abv(x):
if int(x) < 0:
return -x
if int(x) >= 0:
return x
def mul(x,y):
return str(int(x)*int(y))
def div(x,y):
return str(int(x)/int(y))
def max(x,y):
if sx > y:
return (str(x) + ' is greater than ' + str(y))
if x < y:
return (str(y) + ' is graeter than ' + str(x))
if x == y:
return 'its the same!'
def min(x,y):
if x < y:
return (str(x) + ' is smaller than ' + str(y))
if x > y:
return (str(y) + ' is smaller than ' + str(x))
if x == y:
return 'its the same!'
while True:
print(" Welcome to simons calculator!\n")
time.sleep(0.5)
print('add to add\n')
time.sleep(0.5)
print('sub to subtract\n')
time.sleep(0.5)
print('abv for absolute value\n')
time.sleep(0.5)
print('mul to multiply\n')
time.sleep(0.5)
print('div to divide\n')
time.sleep(0.5)
print('max to find out which number is greater\n')
time.sleep(0.5)
print('min to find out which number is smaller\n')
time.sleep(0.5)
x = player = (input("whats your first number? : "))
time.sleep(0.5)
y = player = (input("whats your second number? dont fill this one out if your going for absolute value just hit enter : "))
time.sleep(0.5)
player = input('add sub abv mul div max min? which one? : ')
time.sleep(0.5)
if player == 'add':
player = input("your number is " + str(add(x,y))+ " enter to continue")
if player == 'sub':
player = input("your number is " + str(sub(x,y))+ " enter to continue")
if player == 'mul':
player = input("your number is " + str(mul(x,y))+ " enter to continue")
if player == 'div':
player = input("your number is " + str(div(x,y))+ " enter to continue")
if player == 'max':
player = input(str(max(x,y))+ " enter to continue")
if player == 'min':
player = input(str(min(x,y))+ " enter to continue")
if player == 'abv':
player = input("your number is " + str(abv(x))+ " enter to continue")
else:
player = input('you made a typo!')
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。