python - Is my code not working because i'm using an online IDE or is there an error?
问题描述
So, at school, I don't have access to Pycharm, Pyscripter, or Python it's self so I code using an IDE at school. Now, the problem is that I can't use inputs because I get an EOF error.
secret_number = 9
guessc = 0
guess_limit = 3
while guessc < guess_limit:
guess = int(input('Guess: '))
guessc += 1
if guess == secret_number:
print('You won!')
break
I get an EOF error whenever I run this and I just wanted to know if that the problem is the IDE or faulty code.
解决方案
PyScripter 很好地解释了这种情况。(顺便说一句——喜欢 PyScripter 这个名字,因为我喜欢名为 PyScripter 的免费、开源 Python IDE。)但我想补充 2 美分:如果你正在为这样的问题苦苦挣扎,你的学校正在帮你一种伤害。首先,您可以从 Python.org 轻松免费地下载和安装所有 Python 内容,或者以稍微更时尚的形式,例如 ActiveState(不,您不必付费)。但是如果你的学校还没有告诉你,他们还没有解释 STDIN 的概念,你还在为交互环境和运行时环境的区别而苦恼……我真的很想知道他们在做什么!拿回你的钱并参加真正的课程是否为时已晚?如果你' 重新为企业工作并且可以让他们支付运费,这些天我最喜欢的方法是引导,自定进度的学习,允许您按照自己的步调进行的课程,但也有一个真正的教练随时待命,可通过电子邮件回答问题并提供指导。考虑这样的课程:https://www.software-skills-training.com/Courses/python-programming-training-course.htm。我刚刚完成了课程,非常棒。
推荐阅读
- javascript - Javascript:尽管条件为真,但如果语句未执行,并且要执行的代码在 If 之外工作
- php - MAMP Mysql 似乎已正确安装,但无法正常工作,因为它应该在 Mac OS X 上安装 localhost
- git - 将 Git 非分支引用推送到远程
- c - 超时后杀死子进程,有多个孩子?
- c - 为什么a + = a在C中等于0?
- java - 在 Java 中是否可以在不使用关键字“implements”的情况下实现接口及其方法?
- vue.js - 在vue中绑定动态img src
- pug - 在不重复属性的情况下应用多个类的方法,这些类在 Pug 中占用多于一行
- java - 将不同的变量传递给反射 getMethod 并调用所述方法
- java - 有没有其他方法可以在不使用 writer 对象和列文本类的情况下在 ITEXT 中绝对定位段落/短语