"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"\n",
"for letter in xrange(ord('Z'),ord('A')-1,-1):\n",
" print chr(letter),\n",
" "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Z Y X W V U T S R Q P O N M L K J I H G F E D C B A\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"def total(x):\n",
" sum=0\n",
" for i in xrange(1,x+1):\n",
" sum=sum+i\n",
" for count in range(10):\n",
" print '-',\n",
" print \"The current sum is\",sum\n",
" \n",
"print \"Computing summation of 5.\"\n",
"total(5)\n",
"\n",
"print \"Computing summation of 6.\"\n",
"total(6)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Computing summation of 5.\n",
"- - - - - - - - - - The current sum is 1\n",
"- - - - - - - - - - The current sum is 3\n",
"- - - - - - - - - - The current sum is 6\n",
"- - - - - - - - - - The current sum is 10\n",
"- - - - - - - - - - The current sum is 15\n",
"Computing summation of 6.\n",
"- - - - - - - - - - The current sum is 1\n",
"- - - - - - - - - - The current sum is 3\n",
"- - - - - - - - - - The current sum is 6\n",
"- - - - - - - - - - The current sum is 10\n",
"- - - - - - - - - - The current sum is 15\n",
"- - - - - - - - - - The current sum is 21\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"