Topics to Be Covered in This Course (Cont.)
 
 Programming Languages (Python)
Various programming languages will be introduced, but the emphasis is on Python.
Below shows a web program prints the first no Fibonacci numbers by using:
 HTML (7.html) ⇒ Python (Fib.py) ⇒ the Web
 
 
  
  
   
 
  
   | 
    
     ~/public_html/cgi-bin/101/1/Fib.py (simplified)
    
    | 
   
  
    | 
  
  
   
    
     #!/usr/bin/python
#
# Python program to print Fibonacci numbers
#     0 1 1 2 3 5 8 13 21 34 55 89 ... 
# where the 3rd number is the sum of the previous 2 numbers.
#
import cgi       # CGI module
# FieldStorage object saves the data from the client.
form = cgi.FieldStorage( )
act  = form["act"].value
no   = form["no" ].value
if ( act == "Print Fibonacci numbers" ):
  # Print HTML.
  print( "Content-type: text/html\n\n" )
  a  = 0
  b  = 1
  no = int( no )
  if ( no <= 2 ):
    print( "The first 2 numbers are 0 and 1." )
  else:
    i = 0
    while ( i < no ):
      print a, " "
      c  = a + b
      a  = b
      b  = c
      i += 1
    
    | 
  
 
   
  
 
 
 
 
  
   
          
     Don’t worry if Plan A fails,      
           there are 25 more letters in the alphabet.
         
    |