Python 获取“不能将序列与'float'类型的非int相乘”错误
如何解决此问题?金额是一个字符串,因为输入返回字符串。首先通过数值类型的构造函数将其转换为数字Python 获取“不能将序列与'float'类型的非int相乘”错误,python,Python,如何解决此问题?金额是一个字符串,因为输入返回字符串。首先通过数值类型的构造函数将其转换为数字 currencies = {'yen': 0.0067, 'bsp': 1.35, 'usd': 0.65, 'ero': 0.85} if choice == "2": Current_Currency = input("What currency do you want to exchange: Japenese Yen if so please type yen // British
currencies = {'yen': 0.0067, 'bsp': 1.35, 'usd': 0.65, 'ero': 0.85}
if choice == "2":
Current_Currency = input("What currency do you want to exchange: Japenese Yen if so please type yen // British Sterling Pound please type bsp // US Dollers please Type usd // Euro please type ero.")
amount = input("Type amount you wish to exchange")
Future_Currency = input("What currency do you want to exchange into: Japenese Yen if so please type yen // British Sterling Pound please type bsp // US Dollers please Type usd // Euro please type ero.")
New_Amount = currencies[Future_Currency] / currencies[Current_Currency] * amount
请格式化您的代码。如果你的问题是这样呈现的,没有人会费心花时间去阅读它。所以我的问题不是问我能不能得到一个答案,我所要做的就是复制并粘贴它,而是解决问题。是的,你试着用你唯一的假期来浪费时间,因为你不能理解和修复一行代码,所以我的假期就完了做的是复制和粘贴在我很抱歉,我是一个新手,一旦我完成了这一点,我可以开始学习它,所以我做什么知道对不起
amount = float(amount)