KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

Create a Python package and one module under it. Write Python code to use this package.

Python Modules

1 Like

Answer

# days.py
def calculate(total_days):
    months = total_days // 30
    remaining_days = total_days % 30
    return months, remaining_days
# calculate.py
from days import calculate

total_days = int(input("Enter the total number of days: "))
months, remaining_days = calculate(total_days)
print("Total number of months:", months)
print("Remaining days:", remaining_days)
Output
Enter the total number of days: 100
Total number of months:  3
Remaining days:  10

Answered By

2 Likes


Related Questions