Jump to content

incorect answer

Tomic
Go to solution Solved by Neil,

You want python's "elif" statement, and additionally, you can't just say "money - 50". That's just not a statement that does anything You want "money -= 50"

def rental_car_cost(days):    money = days * 40     if  days >= 7:         money -= 50    elif days >= 3:         money -= 20    return money 
>>> def rental_car_cost(days):...     money = days * 40...     if  days >= 7:...          money -= 50...     elif days >= 3:...         money -= 20...     return money...>>> rental_car_cost(3)100>>> rental_car_cost(7)230
def rental_car_cost(days):    money = days * 40     if  days >= 7:         money - 50    else:         days >= 3         money - 20    return money  

help this is python and instead of returining 100 for 3 days it returns 120 rendering the else incorect

Red Fury: Cpu intel i5 4960k GPU 1060 6gb, Cooling  noctua dh15 storage 1tb sshd 250gb ssd mobo gigabyte z97p-3 case fractal r4 ram hyper x fury red 8 gb psu 550w xfx ts os win 10 monitor lg 25um56 

Link to comment
Share on other sites

Link to post
Share on other sites

def rental_car_cost(days):    money = days * 40     if  days >= 7:         money - 50    else:         days >= 3:         money - 20    return money  

You forgot a :

Remember kids, the only difference between screwing around and science is writing it down. - Adam Savage

 

PHOΞNIX Ryzen 5 1600 @ 3.75GHz | Corsair LPX 16Gb DDR4 @ 2933 | MSI B350 Tomahawk | Sapphire RX 480 Nitro+ 8Gb | Intel 535 120Gb | Western Digital WD5000AAKS x2 | Cooler Master HAF XB Evo | Corsair H80 + Corsair SP120 | Cooler Master 120mm AF | Corsair SP120 | Icy Box IB-172SK-B | OCZ CX500W | Acer GF246 24" + AOC <some model> 21.5" | Steelseries Apex 350 | Steelseries Diablo 3 | Steelseries Syberia RAW Prism | Corsair HS-1 | Akai AM-A1

D.VA coming soon™ xoxo

Sapphire Acer Aspire 1410 Celeron 743 | 3Gb DDR2-667 | 120Gb HDD | Windows 10 Home x32

Vault Tec Celeron 420 | 2Gb DDR2-667 | Storage pending | Open Media Vault

gh0st Asus K50IJ T3100 | 2Gb DDR2-667 | 40Gb HDD | Ubuntu 17.04

Diskord Apple MacBook A1181 Mid-2007 Core2Duo T7400 @2.16GHz | 4Gb DDR2-667 | 120Gb HDD | Windows 10 Pro x32

Firebird//Phoeniix FX-4320 | Gigabyte 990X-Gaming SLI | Asus GTS 450 | 16Gb DDR3-1600 | 2x Intel 535 250Gb | 4x 10Tb Western Digital Red | 600W Segotep custom refurb unit | Windows 10 Pro x64 // offisite backup and dad's PC

 

Saint Olms Apple iPhone 6 16Gb Gold

Archon Microsoft Lumia 640 LTE

Gulliver Nokia Lumia 1320

Werkfern Nokia Lumia 520

Hydromancer Acer Liquid Z220

Link to comment
Share on other sites

Link to post
Share on other sites

@revsilverspine thanks but an error still occurs

Red Fury: Cpu intel i5 4960k GPU 1060 6gb, Cooling  noctua dh15 storage 1tb sshd 250gb ssd mobo gigabyte z97p-3 case fractal r4 ram hyper x fury red 8 gb psu 550w xfx ts os win 10 monitor lg 25um56 

Link to comment
Share on other sites

Link to post
Share on other sites

You want python's "elif" statement, and additionally, you can't just say "money - 50". That's just not a statement that does anything You want "money -= 50"

def rental_car_cost(days):    money = days * 40     if  days >= 7:         money -= 50    elif days >= 3:         money -= 20    return money 
>>> def rental_car_cost(days):...     money = days * 40...     if  days >= 7:...          money -= 50...     elif days >= 3:...         money -= 20...     return money...>>> rental_car_cost(3)100>>> rental_car_cost(7)230

--Neil Hanlon

Operations Engineer

Link to comment
Share on other sites

Link to post
Share on other sites

@Neil thanks for pointing that out

Red Fury: Cpu intel i5 4960k GPU 1060 6gb, Cooling  noctua dh15 storage 1tb sshd 250gb ssd mobo gigabyte z97p-3 case fractal r4 ram hyper x fury red 8 gb psu 550w xfx ts os win 10 monitor lg 25um56 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×