Monday, 9 February 2015









Python


Questions:




1) What is the formula used to return a whole number when doing division?


The formula used to return a whole number is %


2) What is the formula used to return the remainder when doing division? How does it work? Explain with an example.



You can find the remainder when doing division using the %
for example:

26%7
5

3) Why is it important in Computing to understand number systems and in particular binary?

Everything a computer stores is represented as binary, so when a IT professional such as a programmer needs to check some data, such as something being transfered over a network it will be in binary, they need to convert that into what ever it represents.

4) How does binary work? i.e. how do we convert a number from decimal into binary?

Binary follows the same pattern as Decimal except that instead of being base 10, it is instead base 2. Instead of having 10 symbols to represent values we have two ( 0 and 1 ).
So Decimal is a base 10 number system, we have 10 symbols and multiply by powers of 10. It follows that Binary is a base 2 number system, we have two symbols and multiply by powers of 2.
If I have the binary number 101010, this translates into decimal as:
32 + 0 + 8 + 0 + 2 + 0 = 42
Or:
1 * 2532
0 * 240
1 * 238
0 * 220
1 * 212
0 * 200
DecimalBinary
00000

10001

20010

30011

40100

50101

60110

70111
81000

91001

101010

111011

121100

131101

141110

151111

1 comment:

  1. Add some commentary to the pictures you have posted. For Q1 how are whole numbers returned in Python? For Q2, explain in words how the % operator works. Q3 try to avoid words such as everything, something, whatever. Try to replace each word with an example e.g. 'all data', 'a piece of data', 'the data a user inputs' to be more specific.For Q5 are these your own explanations?

    ReplyDelete