Search code examples
pythonfunctionpython-requestspycharmpython-3.7

Find the cost in but it keeps returning errors


my_money = input('How much money do you have? ')
boat_cost = 20 + 5

if my_money < boat_cost:
    print('You can afford the boat hire')
else :
    print('You cannot afford the board hire')


Solution

  • Try this code snippet and see the original code problem:

    my_money = int( input('How much money do you have? '))
    boat_cost = 20 + 5
    
    if my_money >= boat_cost:
        print('You can afford the boat hire')
    else :
        print('You cannot afford the board hire')