Beispiel #1
0
 def test_subtract(self):
     self.assertTrue(maths.sub(2, 1) == 1)
Beispiel #2
0
car2.battery
car2.battery="300amp"
car2.battery
car1.battery
car1.getbatterysize()
car1.setbatterysize("500amp")
car1.getbatterysize()
# MOdule
# %load maths.py  (%load maths.py)
def add(a,b):
    return a+b
def sub(a,b):
    return(a-b)
import maths as m
m.add(1,4)
m.sub(23,4)
# Data files
with open ("file_name.txt","r") as file:
    content=file.read()
    print(content)
with open ("name.txt","w") as file:
file.write("This is testing")
with open ("file_name.txt","a") as file:
file.write("aoe me a gia")
with open ("ao_gia.txt","w+") as file:
    file.write("You can do what you are interested in")
    file.seek(0)
    print(file.read())
with open ("name.txt","r+") as file:
    file.write("me jet gia")
    file.seek(0)
def test_sub():
    assert maths.sub(2, 1) == 1
Beispiel #4
0
import maths
from maths import divide
print(maths.add(10,20))
print(maths.sub(20,10))
print(divide(20,30))
Beispiel #5
0
import maths as m       #maths.py files along with the functions are imported

print(m.add(6,4))
print(m.sub(6,4))
print(m.multiply(6,4))