if you would like to run the other files just press the three dots and then show hidden files
. Next, go to the file .replit
and change the run="python main.py"
statement to run="python wanted_file.py"
Or, you can do
main.py:
import os # unimportant to your program, ignore
print("rohan")
os.system("python next_file.py")
loop.py:
#largest
# largest = None
# for the_num in [5,6,14441,12,100,2,-1000,200]:
# if largest is None: #is --> better than ==
# largest = the_num
# elif largest < the_num:
# largest = the_num
# print("smallest",largest)
# smallest
# smallest = 0
# for the_num in [5,6,14441,12,100,2,-1000,200]:
# if smallest is 0: #is --> better than ==
# smallest = the_num
# elif smallest > the_num:
# smallest = the_num
# print(smallest)
# print("smallest",smallest)
#counting
# score = 00
# for the_num in [5,6,14441,12,100,2,-1000,200]:
# score = score + 1
# print(score,the_num)
# print("score",score)
#suming
# score = 00
# for sum in [5,6,14441,12,100,2,-1000,200]:
# score = score + sum
# print(score,sum)
# print("sum",score)
#average
count = 0
#filtering
# for smallest in [5,6,14441,12,100,2,-1000,200]:
# if smallest < 100:
# print(smallest)
#using boolen
# get = False
# for i in [5,6,11,12,100,2,-1000,20,100]:
# if i == 100:
# get = True
# break
# else:
# get = get
# print(get)
#advance loops
import os
for i in "rohan":
print(i)
#slicing
name = "Rohan Gurav"
print(name[0:2])
print(name[-2])
lower = name.lower()
print(lower)
os.system("python next_file.py")
function.py:
#builing function
#parameters
import os
def rohan(surname):
if surname == 'gurav':
print("Hello, Rohan")
elif surname == "parasharam":
print("you have to type surname, Okay. ")
else:
print("I don't know you.")
# simple one
def ron():
print(
'''
I LOVE TO CODE IN PYTHON,
I have learned it from expert Dr.Chuck .
''')
rohan("parasharam")
rohan("gurav")
ron()
def wish():
return "Good Morning"
print(wish(),"rohan") #we can write fuunction in function.
#multi para/argu
def multi(a,b,):
multiple = a*b
return multiple
print(multi(5,5))
os.system("python next_file.py")
calculator.py:
impor os
def greet():
return "Hello"
name = input("What's your name? ")
print(greet(),name)
def divide(a,b):
div = a / b
print(div)
def multiply(a,b):
multi = a * b
print(multi)
def subtract(a,b):
sub = a - b
print(sub)
def addition(a,b):
add = a + b
print(add)
# personal calculator
while True:
what = str(input("What do you want to do?[A,S,D or M] "))
what = what.upper()
print(f"You typed \t \'{what}\'")
if what == "A":
num = int(input("write number, which you want to add. "))
num2 = int(input("write number, with which you want to add. "))
addition(num,num2)
elif what == "S":
num = int(input("write number, which you want to subtract. \n(Tip:write bigger no., for positive result) "))
num2 = int(input("write number, with which you want to Subtract. "))
subtract(num,num2)
elif what == "M":
first_num = int(input("write number, which you want to multiply. "))
second_num = int(input("write number, with which you want to multiply. "))
multiply(first_num,second_num)
elif what == "D":
nom = int(input("put the upper no. to divide... "))
de_nom = int(input("put the lower no. to divide.. "))
divide(nom,de_nom)
else:
print("you are at wrong place")
continue
os.system("python next_file.py")
for the last solution, take out os.system("python next_file.py")
is you it’s the last file you want to run. This will run each file one after the other. Replace next_file.py
to what you want to run after your current file (such as in main.py
change it to loops.py
)