首页 > 解决方案 > 是否有任何具有可用内置模块的在线 Python IDE?

问题描述

我找到了很多在线 Python 编辑器,但没有一个有可用的模块。math是否有任何在线可用的 IDE 具有简单的模块,例如random内置的?

标签: pythonpython-3.xpython-2.7

解决方案


好吧,我没有测试任何种类的在线 python 解释器,但是一个快速的实验产生了这个网站。它可以运行您的基本甚至一些高级内置模块

测试代码如下

# Online Python compiler (interpreter) to run Python online.
# Write Python 3 code in this online editor and run it.
import random

#testing a random built-in module
marks = {
    "English": random.randint(1, 100),
    "Bio": random.randint(1, 100),
    "Botany": random.randint(1, 100),
    "Literature": random.randint(1, 100),
}

for mark in marks.keys():
    print("You got ", marks[mark] , " marks in ", mark)

#testing the built-in sum function
total = sum([marks[subject] for subject in marks.keys()])
print("Total Marks", total)

输出如下

在此处输入图像描述


推荐阅读