<body>
 <div> 
  <h2>Python Documentation</h2>
   <ul>
     <li>Introduction</li>
     <li>What You Should Have Already</li>
     <li>Your First Program</li>
     <li>Comments And Pound Characters</li>
     <li>Numbers And Maths</li>
     <li>Variables And Names</li>
     <li>Variables And Functions</li>
     <li>If...Else Statement</li>
     <li>Loops</li>
     <li>Reference</li>
   </ul>
 </div> 
 <div>
  <h2>Introduction</h2>
   <p>Python is a widely used high-level programming language for general-purpose programming. An interpreted language, Python has a design philosophy which emphasizes code readability and a syntax which allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale.</p> 
     <br/>
   <p>Python features a dynamic type system and automatic memory management and supports multiple programming paradigms, including object-oriented, imperative, functional programming, and procedural styles. It has a large and comprehensive standard library.
This simple book is meant to get you started in python. </p>
         <br/>
  <h2>What You Should Have Already</h2>
   <p>This guide assumes you have the basic to be a <strong>Pythonista.</strong> Which includes the following:</p>
    <ul>
     <li>A strong desire and passion to learn Python</li>
     <li>A computer to learn the program with</li>
     <li>Ability to read and write in English, because this is all going to be in English</li>
     <li>A dogged and can do attitude, because sometimes you may be angry and frustrated because your code refuses to run or doesn't run as planned</li>
     <li>A text-editor</li> 
   </ul>
  <h2>Your First Program</h2>
   <p>For most people the first code they write is 'Hello World'. To do this, open up your text-editor, type the below and press enter</p>
    <xmp>
     print "Hello World!!!"
      'Hello World'
    </xmp>
   <p>Congrats you just typed your first line of code. In programming what you just typed is called a string. A string is anyt text you put within parenthesis i.e. "...". </p>
  <h2>Comments (#)</h2>
   <p>Comment is used to tell you what something does in English, and is also used to disable parts of a program if you need to remove them temporarily. It is written a s the pound sign (#). Here's how you comment out a code in Python. Type what you see below and press enter</p>
   <xmp>
     # print "I am need to learn code"
       print "I am learning to code"
         'I am learning to code'
    </xmp>
   <p>You will notice the string where '#' is in front of didn't get displayed on the screen. This is because it has been commented out from showing</p> 
  <h2>Numbers And Maths</h2>
   <p>Every programming language has some kind of way of doing numbers and math. The major arithmetic calculations can be done using python, but we also have some more. See examples below</p>
    <ul>
     <li> + : plus</li>
     <li> - : minus</li>
     <li> / : slash (used for division)</li>
     <li> * : asterisk (used for multiplication</li>
     <li> % : modulo (used to return the number that remains after division) </li>
   </ul>
  <p>Lets do some examples</p> 
   <xmp>
      4 + 5
      9
      20 - 3
      17
      100 / 5
      10
      54 % 5
      4
    </xmp>  
  <h2>Variables And Names</h2>
   <p>Now you can print things with print and you can do math. The next step is to learn about variables. In programming a variable is nothing more than a name for something. Similar to how my name "Tobi" is a name for, "The human who wrote this documentation." Programmers use these variable names to make their code read more like English. So variable can be defined as just a way of naming something you need to call again.    </p>
    <xmp>
      cars = 20
      parking_space = 5
      car_space_per_parking_space = 2
      parkable_cars = 10
      
      print "There are", cars, "cars available."
      print "But there are only" parking_space, "parking space, which can accomodate only" car_space_per_parking_space, cars in each space"
      print "That means we can only park" parkable_cars, "cars"
    </xmp> 
   <p>Type the example above and click enter</p>
    <xmp> 
      There are 10 cars available.
      But there are only 5 parking space which can accomodate only 2 cars in each space
      That means we can only park 10 cars
    </xmp>  
  <h2>Variables And Functions</h2>
   <p>A function is like a mini-program within a program. You create a function by typing the word "def". Using a little code sample let's look at what a function is and does</p>
    <xmp>
      def hello
    </xmp>  
   <p>Try to do carefully follow the example and understand it. From the next chapter, we will do really interesting stuff.</p>
  <h2>If...Else Statement</h2>
   <p>These are statements used to instruct the computer on what to do based on an action. There are 3 of these statements; if, elif, and else. As usual, lets take an example to explain this</p>
    <xmp>
      people = 30
      cars = 20
      cats = 50
      
      if cars > people:
          print "We have enough space to go out"
      elif cats < people:
          print "We need to get  spaces for more people"
      else:
          print "Not sure what to do"   
                         
               Example 2        
                         
       if cats > people:
          print "That's too much cats in the world"
      elif cars < people:
          print "Yes people should be more than cat"
      else:
          print "Seems the cats are struggling to keep up"                   
    </xmp>  
   <p>Just like the english word 'if'. The statement 'if' tells the computer what to do if a value return as true, elif (meaning else..if) is similar, it simply gives it a second option if the first doesn't return true. Else is the fnal statement, that simply means 'if other statements don't return true, then end by printing this'. You can have as much elif as you want in a code-block. Every if statement must end with an else staement</p>   
   <p>All the examples and ideas here are taken from <a href="https://learnpythonthehardway.org/">Learn Python The Hard Way</a>. You can read more about the documentation on <a href="https://docs.python.org">Python's website</a></p>
 </div>  
</body>

External CSS

  1. https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css

External JavaScript

This Pen doesn't use any external JavaScript resources.