简体   繁体   English

为什么我的简单 python 程序给我错误

[英]Why is my simple python program giving me errors

enter image description here在此处输入图像描述

It is giving me error idk why I want to also add string if possible in the place of int它给了我错误 idk 为什么我还想在可能的情况下添加字符串来代替 int

You can't add strings and numbers with ",", you have to use "+" or the new formatted strings (Since Python 3.6):您不能使用“,”添加字符串和数字,您必须使用“+”或新的格式化字符串(自 Python 3.6 起):

print(f"Here is your text. You can add variables with {variableName} or calculation like {a + b}")

Hope that helps.希望有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么使用!=运算符会在我的python程序中给我一个简单的错误? - Why is using the != operator gives me a simple error in my python program? 为什么该Python程序给我一个错误? - Why is this Python program giving me an error? 我写了这个 python 程序,它一直给我错误 - I wrote this python program and it keeps giving me errors 为什么Python中的if语句给我一个错误? - Why is my if statement in Python giving me an error? 为什么我的python程序给出了if / else语句中的变量未定义的错误? - Why is my python program giving me the error that a variable in an if/else statement is undefined? 为什么每次使用 ursina 引擎时,我的 python 程序都会给我一个 filenotfound WinError 3? - Why is my python program giving me a filenotfound WinError 3 every time I use the ursina engine? 为什么我的独立程序退出而不给我机会阅读结果(python)? - Why does my standalone program exits without giving me a chance to read the results (python)? 我不明白为什么我的端口扫描仪 Python 程序出错 - I can't understand why my Port Scanner Python program is giving errors 为什么 Python 文件夹排序脚本给我错误而不是工作? - Why is the Python Folder Sorter Script Giving me Errors and not Working? python tkSnack给我错误 - python tkSnack is giving me errors
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM