Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

Katrin_Kolarska avatar Katrin_Kolarska 0 Точки

Programming Basics; Phyton - Fuel Tank - Part 2

Здравейте, 
решавам задачата Fuel Tank - Part 2 - последната от допълнителните за Conditional Statements. В джъдж ми дава 90/100, но не мога да си открия грешката. Ще може ли някой да ми подскаже или да ми даде неговото решение :)
Благодаря. 

fuel_type = str(input())
fuel_quantity = float(input())
discount_card = str(input())
price= float()

if discount_card == "Yes" and fuel_type == "Gas":
    if fuel_quantity > 25:
        price = 0.9*(0.85 * fuel_quantity)
    elif 20 < fuel_quantity <= 25:
        price = 0.92*(0.85 * fuel_quantity)
    else:
        price = 0.85 * fuel_quantity
if discount_card == "No" and fuel_type == "Gas":
    if fuel_quantity > 25:
        price = 0.9 * (0.93*fuel_quantity)
    elif 20 < fuel_quantity <= 25:
        price = 0.92 * (0.93*fuel_quantity)
    else:
        price = 0.93*fuel_quantity
if discount_card == "Yes" and fuel_type == "Diesel":
    if fuel_quantity > 25:
        price = 0.9*(2.21 * fuel_quantity)
    elif 20 < fuel_quantity <= 25:
        price = 0.92*(2.21 * fuel_quantity)
    else:
        price = 2.21 * fuel_quantity
if discount_card == "No" and fuel_type == "Diesel":
    if fuel_quantity > 25:
        price = 0.9 * (2.33 * fuel_quantity)
    elif 20 < fuel_quantity <= 25:
        price = 0.92 * (2.33 * fuel_quantity)
    else:
        price = 2.33 * fuel_quantity
if discount_card == "Yes" and fuel_type == "Gasoline":
    if fuel_quantity > 25:
        price = 0.9*(2.10 * fuel_quantity)
    elif 20 < fuel_quantity <= 25:
        price = 0.92 * (2.10 * fuel_quantity)
    else:
        price = 2.10 * fuel_quantity
if discount_card == "No" and fuel_type == "Gasoline":
    if fuel_quantity > 25:
        price = 0.9 * (2.22 * fuel_quantity)
    elif 20 < fuel_quantity <= 25:
        price = 0.92 * (2.22 * fuel_quantity)
    else:
        price = 2.22 * fuel_quantity

print(f'{price:.2f} lv.')
Тагове:
0
Programming Basics 12/07/2020 20:16:31
roshavi4ak avatar roshavi4ak 4 Точки

Здравей :)
От това което видях, грешката ти е в цената на Gasoline с карта. Намалението трябва да е с 18 ст. на литър, а ти го смяташ с 12. Т.е. вместо 2.10 трябва да е 2.04. Така ми го дава 100/100.

И си мисля че между 20 и 25 включително трябва да обхваща и 20. т.е. трябва да е навсякъде 20 <= х <= 25

Обаче си мисля че това решение е доста трудоемко за писане и както си личи, лесно за грешки. Сега ще реша задачата и ще покажа моето решение.

Приятна седмица и приятно програмиране! 

EDIT: Ето го моето решение: https://repl.it/@KrastyoKrastev/Fuel-Tank-2
Така всички цени и дискаунти са на едно място. С dictionary щеше да стане дори малко по-лесно.

0
13/07/2020 16:16:39
Katrin_Kolarska avatar Katrin_Kolarska 0 Точки

Много Ви благодаря, Вие сте супер smiley - не знам как не го видях.
Да, много се чудих как да я разпиша - другата седмица ни предстои да вземем вложените ифове и с времето се надявам да се науча да ги пиша по умно.
Благодаря Ви и приятен ден!
 

0
mukeshrao avatar mukeshrao 1 Точки

This reception apparatus CPE is incredible for long-run association. It accompanies diverse "modes" to fill in as an AP switch/repeater/AP/and so on. It can likewise be reset remotely if the conditions require it, which implies no climbing outside to kill on and this advantageous, smooth passageway. Wifi Range Extender Discussed on GadgetRio This open air satellite-style Wi-Fi sponsor is ideal for introducing it outside close to a home, RV, office, or on any property. It comes at a moderate cost for significant distance expansion. It is likewise exceptionally looked into and every recieving wire is tried before getting sent to the purchaser.

0
1
felinadoe avatar felinadoe 0 Точки

The previous Rio Casa Enbloc was offered to Oxley-Lian Beng Venture Pte Ltd at a cost of $575 Million and it is noted by investigators that a further S$208 Million is required for the top up for the land

riverfront residences at upper serangoon

. The previous Rio Casa highlights a sum of 7 squares for the plot of land and it is noticed that there is an amazing facing of the view for Riverfront Residences with an aggregate of 200m confronting the ocean. Riverfront Residences Enbloc is wide expected to be generally welcomed as there is no new dispatches in the region for quite a while.

0
jessijoel avatar jessijoel 1 Точки

Vinyl flooring is made out of various layers packed together – giving it its top notch favorable position of being one of the stronger kinds of eco flooring in Singapore. 

carpets singapore 

Contrasted with different materials, vinyl flooring takes the spot for solidness, simplicity of establishment, and cost thought. While appropriately made for higher measures of pedestrian activity, it additionally lessens clamor – a significant factor for those with youngsters at home.

0
cathrinerihas avatar cathrinerihas 1 Точки

Also called hacking. You might be asking yourself, "Is that actually a kind of programming improvement?" Certainly, and it's a basic field to be dealing with nowadays. Infiltration analyzers ("white-cap" moral programmers) and digital security specialists cooperate to benefit organizations and their frameworks and information. software developers The digital security group creates programming to stay with significant resources safe from burglary, infections and different pernicious attacks.The pentester, or entrance analyzer, at that point attempts to 'hack' into the framework to discover where the weaknesses, or shaky areas, are. Thusly, there's less possibility of your "dark cap" real pernicious programmer getting into your significant information.

0
danieldegarmo avatar danieldegarmo 1 Точки

Your Wi-Fi switch is the core of your home organization. It ensures all your information gets shipped off the correct spots, and it supplies your gadgets with a consistent web association. However, Best Countertop Pizza Ovens in a huge home, those associations can get stalled when the sign bobs off dividers, floors, and different hindrances.

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.