In this part you will learn how to use python interpreter and also about writing basic constructs like for if else and functions
def bubblesort(arr):
for i in range(len(arr)-1):
for j in range(len(arr)-1):
if(arr[j]>arr[j+1]):
temp=arr[j]
arr[j]=arr[j+1]
arr[j+1]=temp
arr=[5,1,1,45,233,2,34,343]
print arr
bubblesort(arr)
print arr
You can execute stuff dynamically using exec function
exec("x=1;print x")
There is a lot of support for databases using python.
import MySQLdb
conn=MySQLdb.connect("localhost","test","test123","Blog")
sql="SELECT * FROM USERS"
cursor=conn.cursor()
cursor.execute(sql)
rows=cursor.fetchall()
for i in range(len(rows)):
for j in range(len(rows[i])):
print (str)(rows[i][j]) +",",
print "\n"
You will need MySQLdb which can be downloaded from sf.net