Python Fortune Telling Program




How to create a python fortune-telling program

This is a Python 3 tutorial for creating a fortune teller program or cootie catcher program whichever you prefer. Python is a good beginner program language for anyone to learn because it has so many applications in the real world. Learn python today. In this tutorial, I utilized the lightweight integrated development environment (IDE) Geany. First I downloaded Virtual Box and then installed Kali and after installing Kali, I then installed the Geany IDE. To start off this tutorial after opening up the Geany IDE I usually always get started with a comment about what the program that I am building is. By using the # key you are able to then create this comment in Python


# This is a simple fortune teller program or Cootie Catcher Program

 

After the comment, I would usually then import the functions that I would utilize within the program. In this program, I will be utilizing random and time functions.


import random

import time


Next, I will initialize our variable x to 1 then follow that up with a while loop.

x=1

The while loop continues to execute as long as the value of x is equal to 1.
while x ==1:
              numbers = int(input("Pick a number between 1 and 4: "))
              if numbers == 1:
                             print("Ahhh individuals whom pick 1 are very intelligent and personable")
              elif numbers == 2:
                             print("people who pick the number 2 are strong minded!")
                             time.sleep(3)


              sel = input("Pick your favorite color: ")


The code above is just a sample of what this code would look like below I have created a tutorial to help better explain this python program and its many functions.






No comments:

Post a Comment

Best Devices To Get Started With Programming

Having a good solid computer is vital to start coding, and HP offers solid laptops for coders at every level.