Why don't online compilers support modules and other stuff?

Yesterday I was finding out out other ways to print things in Python without using print statement. I went to an online compiler and typed this:

Import sys

sys.stdout.write("Hello World") 

Then it showed this error:

Error: A module you have imported isn't available at the moment. It will be available soon.

Although in this compiler it showed this, but on others it just throws some other errors as well. My question is what exactly is a module and why are they not supported in online compilers?

Plus there are other questions I have. We can print things in Python without using the print statement.

  1. Is it true for all the programming languages? Or at least a few of them? If yes then what are they?
  2. If there are other ways to print things in python, why should we use print statement (excluding the reasons that it is simpler and we will be importing a module pretty much unnecessarily). I mean are there any other reasons that we should always use the print function?
  3. Let’s say I don’t want to use the print function and want to use the stdout atteibute in sys module. Should programmers stay away from importing unnecessary modules? If yes then why excatly? What are the disadvantages of importing a module?

Thanks a Lot

What online tool were you using? Replit supports modules https://replit.com/

You might need to install it first in the environment before you can import it in your code. Can usually achieve this by typing pip install <module> at the command prompt (pip install sys) Then the code will be downloaded and ready to import.

A module is external files of code that you want to use in your code without re-writing it all in your project.

1 Like

im currently on a school crome book and I’m using python and Replit is blocked

oh and this is my code incase something might be wrong with that

def myfunc(hello_1):

import random

for x in range (0,part1):
    part1= "."*x


while part1_2 < len(str(part1))+1:
    part2=abc[random.randrange(0, len(abc))]
    end2=str(end) + part2
    part1_2 = part1_2+1

import time

import time 
import random
print("hello user"+str(end[2:]))

def myfunc(minescracher_username):
    minescracher_username=[minescracher_username,input("please input what you will like you user name to be")]
def myfunc(newthingforletter):

import random
import time

user_number=input(“please input user number this may contain 1234567890!@#$% it comes after user in hello user “)
for x in range (0,5):
b = “Loading” + “.” * x
print (b, end=”\r”)
for x in range (0,5):
b = “Loading” + “.” * x
print (b, end=“\r”)
for x in range (0,5):
b = “Loading” + “.” * x
print (b, end=“\r”)

Hi, this doesn’t seem related to this topic, can you please start a new one?

Start a new topic and describe what you are trying to do and the problem that you are running into (error message? unexpected results?)

oh ok sorry ill do that later

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.