Пример #1
0
import module
module.add(8, 8)
x = module.add(8, 8)  #store in variable x
print(x)
y = module.sub(8, 8)
print(y)
z = module.div(10, 2)
print(z)
n = module.mul(10, 10)
print(n)
m = module.floordiv(10, 2)
print(m)
l = module.greater(10, 2)
print(l)
'''import math as factorial
x= 3
print(factorial(x))'''
b = module.sqrt(25)
print(b)
import math as feroz
print(feroz.factorial(30))
print(feroz.sqrt(30))
Пример #2
0
import module
a=50
b=5
c=module.mul(a,b)
print(c)    
Пример #3
0
import module

module.test1()

module.test2()

module.cal(5, 2)

module.mul(5)
Пример #4
0
from module import sub, add, mul, div, rt

print(
    "  Menu \n \n --------\n 1: add \n 2: sub\n 3: multiply\n 4: divide \n 5: root\n 6:stop\n "
)
user = int(input(": "))
if user == 6:
    print("프로그램을 종료합니다.")
elif user == 5:
    r_first = int(input("num1: "))
    print(rt(r_first))
elif user not in range(1, 7):
    print("Beep!")
else:
    first = int(input("num1: "))
    second = int(input("num2: "))
    if user == 1:
        print(add(first, second))
    if user == 2:
        print(sub(first, second))
    if user == 3:
        print(mul(first, second))
    if user == 4:
        print(mul(first, second))
Пример #5
0
import module as mod
x = 10
y = 20
print mod.swap(x, y)
print mod.add(x, y)
print mod.sub(x, y)
print mod.mul(x, y)
print mod.div(x, y)
Пример #6
0
#import module file as md1 or as your wish module as md2 as md1 and md2 is another neme in simple way
#Refer another simple name inside of module or file which you have named
import module as md1
print(md1.add(7, 4))
print(md1.sub(10, 5))
print(md1.div(10, 2))

import module as md2
print(md2.floordiv(10, 2))

import module as sha
print(sha.mul(5, 2))

from module import add, sub, mul, div  # way2 to call function from module file
print(add(7, 4))
print(mul(8, 5))

from math import factorial, sqrt
print(factorial(30))
print(sqrt(30))
Пример #7
0
import module as m

print(m.sum(2, 3))
print(m.mul(3, 3))
Пример #8
0
from module import add, sub, mul, div
from module import *

print("Addition is : {0}".format(add(1, 2)))
print("Addition is : {0}".format(sub(1, 2)))
print("Addition is : {0}".format(mul(1, 2)))
print("Addition is : {0}".format(div(1, 2)))

from myMod import *
display()
Пример #9
0
import module
a = int(input("A="))
b = int(input("B="))
ch = 1
while (ch == 1):
    op = int(
        input(
            "Enter the operation\n1.Addition\n2.Subtraction\n3.m\Multiplication\n4.Division:\n"
        ))
    if (op == 1):
        module.add(a, b)
    elif (op == 2):
        module.Sub(a, b)
    elif (op == 3):
        module.mul(a, b)
    elif (op == 4):
        module.div(a, b)
    else:
        print("Invalid Operation!!!")
    ch = int(input("Do you want to continue?(Yes/1,No/0):"))
Пример #10
0
print(x)
print(x.year)
#%A return weekday
print(x.strftime("%A"))
#year month day , others are 0 or none
x = datetime.datetime(2019, 10, 10)
print(x)
# return month
print(x.strftime("%B"))
print("_____________________________")
#challenge 8 53,54
import module
x = module.add(3, 5)
x = module.sub(3, 5)
x = module.div(3, 5)
x = module.mul(3, 5)
print("_____________________________")
import datetime
x = datetime.datetime.now()
print("year:")
print(x.year)
print("time,date:")
print(datetime.datetime.now())
print("month:")
print(x.strftime("%B"))
print("day:")
print(x.strftime("%A"))
print("_____________________________")
#55
#jason use ''
#convert json to dictionary using json.loads()