问题标签 [repl.it]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 枚举属性无法识别
这是我正在运行的代码:
Qubit 代码如下所示:
Z 代码如下所示:
当我运行代码时,我收到此错误:
难道我做错了什么?
c - 使用套接字对 C 中的本地 IP 进行 GET 请求
我正在尝试编写一个 C 代码,该代码GET向本地 IP 地址(在我的网络中)发出 HTTP 请求,该地址在端口 80 上运行网页。请求应返回index.html.
该代码适用于具有 DNS 的真实 IP 的网站(我已经测试过www.olx.ro它的 IP),但是当我尝试放置本地 IP(即 10.74.4.10)时,我收到 400 Bad Request 响应。
这是代码:
如果我更改inet_addr("10.74.4.10")为 inet_addr("2.16.128.73")和"GET /index.html HTTP/1.0\r\nHost:10.74.4.10:80\r\n\r\n","GET /index.html HTTP/1.0\r\nHost:www.olx.ro:80\r\n\r\n"则代码按预期工作。
另外,我想提一下我使用 Repl.it 作为 C 编译器。
编辑:我忘了提,代码停在connect(). 我试过用bind(),还是不行。也许是因为我试图连接到一个特权端口(80),使用不能具有 root 访问权限的在线 C 编译器?
c - 寻找元素平均值的问题
使用 Repl.it 并尝试使用 C 中的函数来平均可变长度数组中的元素。除了返回的平均值之外,我的程序在所有其他 i/o 区域都可以正常工作:
当天的平均值是:-nan。关于问题可能是什么的任何见解?
目标是接收用户输入的双倍输入(例如,在 7 小时内每小时抽取多少品脱血,然后使用函数调用计算这 7 小时内的平均量。
新代码如下:
scheme - 使用方案语言对列表中的符号进行运行长度编码
我正在尝试使用方案语言在列表中查找字母的频率,但我无法在 4 天内完成,并且代码必须在 repl.it 中工作
例如,我们的列表是
我们的输出应该是
(4a) b (2c) (2a) d (4e)
我有代码也可以在 repl.it 上工作
这是我尝试的代码
python - 为什么 webbrowser.open 在 repl.it 中不起作用?
对于 python 保护,我将 repl.it 用于文本冒险游戏。
但webbrowser.open('url went here')
不能在排斥中工作(它没有打开网页页面)。知道为什么吗?
javascript - 为 javascript 创建 Repl.it 布尔函数时出现问题
一直试图找到答案来了解我对 javascript 的业余理解。在 Repl.it 中为我的班级和初学者工作,所以我觉得有很多东西已经被剥离为极端基础,这在我寻找解决方案时没有帮助。
原来的问题是这样做:
我尝试了很多很多不同的组合,试图找出我做错了什么,在这一点上,我只是不知道什么是什么了。这是我最新的猜测之一:
出现错误。社区有什么解决方案吗?
python - 逐个检测一个字符,如果它有一个特定的字母,然后计算它们的个数
我正在尝试制作一个程序来检测您键入的单词中有多少个元音。这是我的源代码(我有多个代码):
我得到了错误:
第二个:
也给了我一个错误:
第三个有点复杂:
您可以在我的个人资料中查看完整的源代码。
我感谢您的帮助。谢谢!
python - How to organize data in a json file created through webscraping
I'm trying to get article titles from yahoo news and organize it in a json file. When I dump the data to a json file it appears confusing to read. How would I go about organizing the data, either after the dump or from the beginning?
This for a web scraping project where I have to get top news articles and their bodies and export them to a json file which can then be sent to someone else's program. For now, I'm just working on getting the titles from the yahoo finance homepage.
This is what ends up being written on the json file (at the time of writing this post):
I would like to code to show each article title on a separate line and remove the random '\'s that appear in the middle.
python - 3 和 1 被解释为字符串
我正在制作一个掷骰子程序,您可以在其中尝试使掷骰子高于计算机,尽管它是完全随机的。我有这个功能:
这会导致 ... 出现等待。
样本输入:
预期输出:
它循环 3 次,并在每个循环之间等待 1 秒。我收到错误
TypeError:“str”对象不可调用
我不明白,因为它是一个数字而不是一个字符串。
我已经尝试在每个部分使用 int() 并且仅在某些部分上使用例如:
和
和
python - 如何在“on message”中实现关闭和重启命令?
我的 Discord 机器人使用 discord.py 运行,使用该on_message功能。如何创建关闭命令和重启 Bot 的命令?
我的机器人在 repl.it 上托管的服务器上运行。
代码:
理想情况下,命令应该响应"!shutdown"and "!restart",并且只能由我使用。