Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

created the vending machine program with Python but quit the program wont work..

import os import sys

Introduction

def intro():

print("Welcome to use my first vending machine")

start = input("Do you want to use the vending machine? Y/n :  ")
if start.lower == 'n':
    print('Bye!')
    sys.exit()

else:
    menu()
    selction_menu()

even though I type n or N, it wont work to quit, it just automatically jump into the next step like else

1 Answer

You need some brackets after lower, like this:

if start.lower() == 'n':