首页 > 解决方案 > 如何在 Python 中修复这个特定的“TypeError:'str' object is not callable”错误?(初学者问题)

问题描述

似乎无法在此代码中找到错误。感谢我能得到的任何帮助。

    x = input("Enter the price of AAPL stock today: ")
    x = int(x)
    y = input("Enter the number of APPLE stocks that you want to buy: ")
    y = int(y)
    print('The total funds required to buy {} shares of AAPL stock at {} 
    dollars is {}'.format(y, x, x*y))

标签: pythoninput

解决方案


您在输出的字符串中缺少 {0}、{1} 和 {2}。


推荐阅读