Chapter 5 Exercises
-5.2
1.18
2.10(a+b)-(a+b)=9a
3.don't get it
4.120,220
5.16,60
6.156
7.2222
8.113
9.220,112
10.ends with 2
11.uhhh
-5.3
1.127, 65535
2. 1001000010101011
3.2EB
4.170302
5.0b101110000
6.
def countBits(n)
count =0
n=bin(n)
while (n!=0)
if (n%2==1):
count++
n//=2
return count
7.argh..
-5.4
1.-1329
2.error, too many bytes
3.rounding error
4.4211
5.16, 5
6.is it 7?
-6.2
1.I don't do
2.I did my homework and went to see a movie
3.either here or there
4.not P or Q
5.ok
6.ok.
7.pretty straightforward
8.P and not Q
-6.3
1.umm, okay.
2.okay
3.okay
4.okay...
5.Pretty sure I did this right, never been good with Sudoku
6.37
7.all true qs are true ps but not vise versa
8.Isn't it the same?
9.Kind of a waste of time
-6.4
1.return (n>0 and n%2==0)
2.x<-1 or x>1
3.b
4.such a waste of time
5.
def isLeapYear(n):
if (n%400)
return True
elif (n%100)
return False
elif (n%4)
return True
else
return False
6.
def isPrime (n):
x=0
while (x<=1000)
if isPrime(x)
Print x
x++
else x++
7.if (x and not s) or (s and not x)
8.ch in range(0,9)
9.negatives
Black Diamonds, wow.
-5.2
1.18
2.10(a+b)-(a+b)=9a
3.don't get it
4.120,220
5.16,60
6.156
7.2222
8.113
9.220,112
10.ends with 2
11.uhhh
-5.3
1.127, 65535
2. 1001000010101011
3.2EB
4.170302
5.0b101110000
6.
def countBits(n)
count =0
n=bin(n)
while (n!=0)
if (n%2==1):
count++
n//=2
return count
7.argh..
-5.4
1.-1329
2.error, too many bytes
3.rounding error
4.4211
5.16, 5
6.is it 7?
-6.2
1.I don't do
2.I did my homework and went to see a movie
3.either here or there
4.not P or Q
5.ok
6.ok.
7.pretty straightforward
8.P and not Q
-6.3
1.umm, okay.
2.okay
3.okay
4.okay...
5.Pretty sure I did this right, never been good with Sudoku
6.37
7.all true qs are true ps but not vise versa
8.Isn't it the same?
9.Kind of a waste of time
-6.4
1.return (n>0 and n%2==0)
2.x<-1 or x>1
3.b
4.such a waste of time
5.
def isLeapYear(n):
if (n%400)
return True
elif (n%100)
return False
elif (n%4)
return True
else
return False
6.
def isPrime (n):
x=0
while (x<=1000)
if isPrime(x)
Print x
x++
else x++
7.if (x and not s) or (s and not x)
8.ch in range(0,9)
9.negatives
Black Diamonds, wow.
אין תגובות:
הוסף רשומת תגובה