0% found this document useful (0 votes)
8 views1 page

Python Travel Cost Calculator Projects

Uploaded by

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

Python Travel Cost Calculator Projects

Uploaded by

Vishwesh J
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Stream: Python Tech Module: Python Fundamentals: Project:

Project: 1
Create a python program that asks the user how far they want to travel. If they want to travel less than

three miles tell them to ride Bicycle. If they want to travel more than three miles, but less than three

hundred miles, tell them to ride Motor-Cycle. If they want to travel three hundred miles or more tell them to

driver Super-Car.

Sample Output:

How far would you like to travel in miles? 2500

I suggest Super-Car to your destination

Project: 2
Let's assume you are planning to use your Python skills to build a PBLApp for Mobile.

You decide to host your application on servers running in the cloud. You pick a hosting provider

that charges $0.51 per hour. You will launch your service using one server and want to know

how much it will cost to operate per day,per week,per month.

Write a Python program that displays the answers to the following questions:

How much does it cost to operate one server per day?

How much does it cost to operate one server per week?

How much does it cost to operate one server per month?

How many days can I operate one server with $918?

Sensitivity: Internal & Restricted

Common questions

Powered by AI

Hosting an application on cloud servers can significantly affect cost management due to flexible pricing models like per-hour rates, such as the $0.51 per hour mentioned for servers. This allows for scalability and efficient resource allocation. However, it requires diligent monitoring to avoid unnecessary spend during idle times, understanding of potential hidden fees like data transfer costs, and strategies like shutting down non-essential servers during off-peak hours to optimize expenses .

To ensure cost efficiency while operating a cloud-based application server, one could use automated scaling to adjust resources based on demand, implement monitoring tools to track usage patterns and optimize runtime, schedule servers to run only when necessary, and leverage promotional credits or bulk discounts offered by the hosting provider. Additionally, regularly reviewing and adjusting the application's code to ensure optimal resource usage can help reduce costs .

To calculate the cost of operating a server, the program multiplies the hourly rate of $0.51 by the number of hours in each period. Daily cost is 24 hours multiplied by $0.51, resulting in $12.24 per day. Weekly cost is 7 times the daily cost, amounting to $85.68. For a monthly cost, it assumes 30 days, totaling $367.20 .

The Python program uses conditional statements to suggest modes of travel based on the distance specified by the user. If the distance is less than three miles, the user is advised to ride a Bicycle. If the distance is between three miles and three hundred miles, the user is advised to ride a Motor-Cycle. For distances of three hundred miles or more, the program suggests using a Super-Car .

Factors to consider include the cost-effectiveness of driving a Super-Car, the time saved compared to other modes of transport, the environmental impact of using such a vehicle, practicality in terms of road conditions and traffic, and personal comfort preferences. While the program provides a recommendation based on distance alone, real-world decisions might also take these additional factors into account .

A potential structure for this Python program would involve defining the hourly cost as a constant, then calculating the daily cost by multiplying it by 24 hours. The function would then compute the number of full days that the budget can cover by dividing the total budget by the daily cost, using integer division to yield an integer result. This approach also considers edge cases such as zero budget or cost, ensuring robust error handling .

Suggesting a Super-Car for long distances assumes that the user prioritizes speed and potentially luxury over cost savings or environmental considerations. It reflects an assumption that users have access to different types of vehicles and are willing to use less economical options for convenience. This highlights the need for considerations of diverse user contexts and potential biases towards high-performing travel modes .

To accommodate additional travel criteria, the program could be modified to first gather user preferences for cost limitations, time constraints, or environmental considerations via additional input prompts. These inputs would be used alongside distance to determine the most suitable travel mode. The logic would involve using a weighted decision-making process that evaluates each criterion to provide a tailored suggestion .

The program could be enhanced to include factors such as cost efficiency by incorporating a cost-per-mile comparison for different vehicles, time efficiency considering average speed and traffic data, environmental impact by estimating emissions per mile, and personal factors like user preferences or comfort. Moreover, it could integrate real-time data sources for traffic and environmental conditions to make dynamic suggestions .

Challenges include fluctuating costs due to changing rates or hidden fees not captured by a fixed rate, potential underestimation of costs related to peak usage times, and inaccuracies due to ignoring regional price variations. These can be addressed by implementing a dynamic pricing model that accounts for variable rates, regularly reviewing provider rate changes, and employing cost monitoring tools that provide more granular insights into actual usage and expenses .

You might also like