Ask coding questions

← Back to all posts
Only Main file runs
mishram1271 (0)

When I add any file on my repl, it does not run. only the main file runs. Please can any one help on this

ash15khng (678) only runs the main file when you run the code.
What language are you using? If you are using Python, you can import your code in the main file by using import filename where filename is the filename without the .py extension. For other languages, I can't really help.

heyitsmarcus (309)

Can you post your repl link please?

mishram1271 (0)

Here I made a new file
If tried to run it, the main file will run instead of the

heyitsmarcus (309)

@mishram1271 As @ash15khng said, you have to use import <filename> where <filename> in this case is Task3.

So, if you wanted Hello World to print at the beginning, your code in the main file would be:

import Task3

st = "1GOAL9"
l = len(st)
st1 = ""
for i in range(0,l):
  e = st[i]
  if (e >='a' and e<='z'):
    st1 = st1 + e
  if (e >='A' and e<='Z'):
    st1 = st1 + e + e
  if (e >='0' and e<='9'):
    st1 = st1 + "#"
heyitsmarcus (309)

@mishram1271 You're very welcome. Happy Coding! =]