summaryrefslogtreecommitdiff
path: root/Beginning_C++_through_Game_Programming/ch2.ipynb
blob: b12d669c1595c5c1bfa9f441aeb2c3bae686e192 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
 "metadata": {
  "name": "ch2"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": "Chapter 2 : Variables and types"
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": "Example 2.1 Page no : 11"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "'''\nexample 2.1 page no :11\n'''\n\nprint \"Hello, world.\" \nprint \"How are you?\" ",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Hello, world.\nHow are you?\n"
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": "Example 2.2 Page no : 11/12"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "'''\nexample 2.2 page no : 11/12\n'''\n\nprint \"Goodbye, \";\nprint \"cruel world!\" ",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Goodbye, \ncruel world!\n"
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": "example 2.3 page no : 14\n"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "'''\nexample 2.3 page no : 14\n'''\nhour = 11;\nminute = 59;\ncolon = ':';\nprint \"The current time is \",\nprint hour,colon,minute",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "The current time is  11 : 59\n"
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": "example 2.4 page no : 16\n"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "'''\nexample 2.4 page no : 16\n'''\n\nhour = 11;\nminute = 59;\nprint \"Number of minutes since midnight: \",\nprint hour*60 + minute \nprint \"Fraction of the hour that has passed: \",\nprint minute/60",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Number of minutes since midnight:  719\nFraction of the hour that has passed:  0\n"
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "",
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}