This blog will feature free tutorials for Java and Python. These tutorials are for beginners to create their first program with these programming languages. Python and Java are good languages for anyone to learn.
Disclosure: This page contains affiliate links. If you choose to make a purchase after clicking a link, I may receive a commission at no additional cost to you. Thank you for your support!
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