Making AI with Python
Introduction
This manual will only work if you know Python. If you don't, go learn it at: Getting Started With Python Programming.
Let's start off with a little challange:
Say 'hi' to the user when they greet the code, and 'bye' when the user says bye to the code.
First, we need to now what the user says. So we can send them a little input box called 'user_says':
user_says = input('Hi or Bye?')
Great! Now we need to recognise if they are saying 'Hi', or if they are saying 'Bye'.
user_says = input('Hi or Bye?') if user_says == 'Hi': pass elif user_says == 'Bye': pass
Nothing happens, no matter what you say. Let's fix that:
if user_says == 'Hi': print('Hello!') elif user_says == 'Bye': print('Bye... :(')