示例#1
0
from converter import kg_to_lbs
kg_to_lbs(100)


#or
import converter
print (converter.kg_to_lbs(70))


import ecommerce.shipping
ecommerce.shipping.calc_shipping()
示例#2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 10 15:46:55 2020

@author: Ada
"""
# use module to organize codes
# refer to each file (containing related codes, classes, etc) as module

import converter
from converter import lbs_to_kg
from utils import find_max


print(converter.kg_to_lbs(70))

print(lbs_to_kg(120))

numbers = [4, 10, 6, 2]
print(find_max(numbers))

#a package : a folder for multiple modules

#Ex2
import ecommerce.shipping

ecommerce.shipping.calc_shipping()

#Ex3
from ecommerce.shipping import calc_shipping
示例#3
0
# importing modules from converter
# import converter
#
# ans = converter.lbs_to_kg(10)
# print(ans)
# another way of importing functions instead of .

from converter import kg_to_lbs

ans = kg_to_lbs(100)
print(ans)

from utils import find_max
array_of_nums = []
n = int(input("Enter the length of list: "))
for i in range(0, n):
    element = int(input())
    array_of_nums.append(element)
# array_of_nums = [1, 2, 3, 4, 57, 8, 9, 6, 4, 5, 6, 7]
ans = find_max(array_of_nums)
print(ans)
示例#4
0
#Module in python is basically a file with some python code which is somehow related
import converter
from converter import kg_to_lbs
print(converter.kg_to_lbs(57))
print(kg_to_lbs(57))

#exercise
import utils
list = [10, 59, 68, 72, 84]
maximum = utils.find_max(list)
print(max(list))
示例#5
0
#module is nothin but the creating some code and put in one other file and then
# call a function from that created file to current file
# here i have creatred some function of converters in conveter.py and imort them to my module file
# so it like header file we create in c language and include it in our surc code
#here the key words are used are import
import converter

converter.kg_to_lbs()
from converter import lbs_to_kg

lbs_to_kg()
s = [10, 55, 30, 70, 44]
from find_max import find_max

find_max(s)
import file

file.school()
file.college()
示例#6
0
import converter
#  or
from converter import lbs_to_kg, find_max

numbers = [10, 13, 2]
max = find_max(numbers)
print(max)

ans = converter.kg_to_lbs(22.5)
print(ans)

ann = lbs_to_kg(50)
print(ann)
示例#7
0
import converter
import utils

print(converter.kg_to_lbs(120))
print(converter.lbs_to_kg(120))
numbers = [12, 3, 4, 5, 60, 78, 9]
max_num = utils.find_max(numbers)
print(max_num)