DEV Community

Sharon Chang'ach
Sharon Chang'ach

Posted on

Python 101:Ultimate Guide To Python

Introduction

If you can learn something new everyday, you can teach something new everyday. -Martha Stewart

What Exactly is python?

Developed in 1991 by Guido Van Rossum, python is an interpreted high level programming language.
I know what you're thinking, why would I learn this when there are so many other languages out there? Well, here are a few reasons why you should start learning it now:

  • It is simple and easy to learn syntax
  • It has automatic garbage collection
  • No more semicolons!
  • Huge amount of libraries
  • Is interpreted

To learn more about python, we will do a fun project :)

What Disney princess would you be?

Have you ever wondered what disney princess you would be? Let's find out.
After creating a new file on your preferred text editor, proceed to write this code:

  • prompt user to enter name and introduce them to the program.
    name= input("What is your name? \n")
    print("Hello "+name+ " Do you ever wonder what disney character you would be? FIND OUT TODAY!")

  • main question for the user
    # questions to help user identify traits
    trait = input("What is your favorite color? pink,blue,yellow or green \n ").lower

  • Sequence of if statements to determine the best character

if trait =="pink":
    ans=input("Do you like adventure? y or n: \n").lower
    if ans=="y":
        print("Hello Rapunzel")
    else:
            print("hello Sleeping Beauty")
if trait == "yellow":
    ans2= input("Would you consider yourself brave? y or n: \n").lower
    if ans2=="y":
       ans3= input("Would you die for anyone? y or n: \n").lower
       if ans3=="y":
           print("hello Moana")
if trait=="blue":
    ans4=input("Would you consider yourself confident? y or n: \n").lower
    ans6=input("Would you consider yourself hardworking? y or n: \n ").lower
    ans7=input("would you consider yourself a leader? y or n: \n").lower
    if ans7=="yes":
        print("Hello Elsa")
    elif ans6=="y":
        print("Hello Snow White")
    elif ans4=="y":
        print("Hello Snow White")

if trait =="green":
    ans8=input("Would you consider yourself a princess? y or n: \n").lower
    if ans8=="n":
        print("Hello Tiana")
    else:
        ans9=input("Would you consider yourself a girly girl? y or n: \n").lower
        if ans9=="n":
            print("Hello Mulan")
        else:
            ans10=input("Do you have a great singing voice? y or n:\n ")
            if ans10=="y":
                print("Hello Ariel")
            else:
                print("Hello Merida")

Enter fullscreen mode Exit fullscreen mode
  • The full code will look like this:
name= input("What is your name? \n")
print("Hello "+name+ " Do you ever wonder what disney character you would be? fIND OUT TODAY!")
# questions to help user identify traits
trait = input("What is your favorite color? pink,blue,yellow or green \n ").lower

if trait =="pink":
    ans=input("Do you like adventure? y or n: \n").lower
    if ans=="y":
        print("Hello Rapunzel")
    else:
            print("hello Sleeping Beauty")
if trait == "yellow":
    ans2= input("Would you consider yourself brave? y or n: \n").lower
    if ans2=="y":
       ans3= input("Would you die for anyone? y or n: \n").lower
       if ans3=="y":
           print("hello Moana")
if trait=="blue":
    ans4=input("Would you consider yourself confident? y or n: \n").lower
    ans6=input("Would you consider yourself hardworking? y or n: \n ").lower
    ans7=input("would you consider yourself a leader? y or n: \n").lower
    if ans7=="yes":
        print("Hello Elsa")
    elif ans6=="y":
        print("Hello Snow White")
    elif ans4=="y":
        print("Hello Snow White")

if trait =="green":
    ans8=input("Would you consider yourself a princess? y or n: \n").lower
    if ans8=="n":
        print("Hello Tiana")
    else:
        ans9=input("Would you consider yourself a girly girl? y or n: \n").lower
        if ans9=="n":
            print("Hello Mulan")
        else:
            ans10=input("Do you have a great singing voice? y or n:\n ")
            if ans10=="y":
                print("Hello Ariel")
            else:
                print("Hello Merida")




Enter fullscreen mode Exit fullscreen mode

Top comments (0)