def get_solar_panel_price(num_panels):
# Starting price for 2 solar panels
base_price = 4200
# Price per additional panel beyond 2
additional_panel_price = 375
# If there are 2 or fewer panels, the base price is used
if num_panels <= 2:
return base_price
else:
# For panels beyond the first two, calculate the extra cost
extra_panels = num_panels - 2
total_price = base_price + (extra_panels * additional_panel_price)
return total_price
def search_address_and_calculate_price():
# Get the address (this could be any input, but we'll use a simple prompt here)
address = input("Enter a UK address: ")
# Check if the address is in the UK (for simplicity, we'll assume all addresses input are valid UK addresses)
print(f"Searching solar panel price for the address: {address}")
# Ask the user how many solar panels they want
num_panels = int(input("Enter the number of solar panels you want: "))
# Calculate and print the price
total_price = get_solar_panel_price(num_panels)
print(f"The price for {num_panels} solar panels at {address} is: £{total_price}")
# Run the function
search_address_and_calculate_price()