我两天来一直在反对这个问题.我是python和编程的新手,所以这类错误的其他例子对我没什么帮助.我正在阅读列表和元组的文档,但没有找到任何有用的东西.任何指针都将非常感激.没有必要寻找答案,只需要更多的资源来查看.我使用的是Python 2.7.6.谢谢
measure = raw_input("How would you like to measure the coins? Enter 1 for grams 2 for pounds. ")
coin_args = [
["pennies", '2.5', '50.0', '.01']
["nickles", '5.0', '40.0', '.05']
["dimes", '2.268', '50.0', '.1']
["quarters", '5.67', '40.0', '.25']
]
if measure == 2:
for coin, coin_weight, rolls, worth in coin_args:
print "Enter the weight of your %s" % (coin)
weight = float(raw_input())
convert2grams = weight * 453.592
num_coin = convert2grams / (float(coin_weight))
num_roll = round(num_coin / (float(rolls)))
amount = …Run Code Online (Sandbox Code Playgroud)