0% found this document useful (0 votes)
12 views2 pages

Python Data Science

Uploaded by

karunakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Python Data Science

Uploaded by

karunakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Project 1:

# Travel Mode Advisor

def travel_advisor():
distance = float(input("How far do you want to travel (in miles)? "))

if distance < 0:
print("Distance cannot be negative.")
elif distance < 3:
print("Ride a Bicycle!")
elif distance < 300:
print("Ride a Motor-Cycle!")
else:
print("Drive a Super-Car!")

travel_advisor()

project 2
# Cloud Hosting Cost Calculator

class CloudHostingCalculator:
def __init__(self, hourly_rate):
self.hourly_rate = hourly_rate

def calculate_daily_cost(self):
return self.hourly_rate * 24

def calculate_weekly_cost(self):
return self.calculate_daily_cost() * 7

def calculate_monthly_cost(self):
return self.calculate_daily_cost() * 30

def calculate_operating_days(self, budget):


return budget / self.calculate_daily_cost()

def main():
hourly_rate = 0.51 # $0.51 per hour
calculator = CloudHostingCalculator(hourly_rate)

print("Cloud Hosting Cost Calculator")


print("--------------------------------")
print(f"Hourly Rate: ${hourly_rate}")

print("\nCost Calculations:")
print(f"Daily Cost: ${calculator.calculate_daily_cost():.2f}")
print(f"Weekly Cost: ${calculator.calculate_weekly_cost():.2f}")
print(f"Monthly Cost: ${calculator.calculate_monthly_cost():.2f}")

budget = 918
print(f"\nOperating Days with ${budget} budget:
{calculator.calculate_operating_days(budget):.2f} days")

if __name__ == "__main__":
main()
Cloud Hosting Cost Calculator
--------------------------------
Hourly Rate: $0.51

Cost Calculations:
Daily Cost: $12.24
Weekly Cost: $85.68
Monthly Cost: $367.20

Operating Days with $918 budget: 75.00 days

=== Code Execution Successful ===

You might also like