import sys
iPtr = 0
fPtr = 0.0
cPtr = 'c'
print sys.getsizeof(iPtr)
print sys.getsizeof(fPtr)
print sys.getsizeof(cPtr)
iPtr = 0
print "The value of iPtr is", iPtr
iPtr = None
print "The value of iPtr is ", iPtr
num = 5
iPtr = id(num)
print "The address of x using id() is ", id(num)
print "The address of x using iPtr is ", iPtr
num = 5
iPtr = id(num)
print "The value of num is ", num
num = 10
print "The value of num after num = 10 is ", num
iPtr = 15
print "The value of num after iPtr = 15 is ", num
num1 = 5
num2 = 14
iPtr = id(num1)
print "The value of num1 is ", num1
iPtr = 2
print "The value of num1 after iPtr = 2 is ", iPtr
iPtr = id(num2)
print "The value of num2 is ", num2
iPtr /= 2
print "The value of num after iPtr /= 2 is ", iPtr
testScore = [4, 7, 1]
print "The address of the array using testScore is ", testScore
print "The address of the first element of the array using &testScore[0] is ", id(testScore[0])
print "The value of the first element of the array using *testScore is ", testScore[0]
print "The value of the first element of the array using testScore[0] is ", testScore[0]
MAX = 3
testScore = [4, 7, 1]
for i in range(MAX):
print "The address of index ", i, " of the array is ", id(testScore[i])
print "The value at index ", i, " of the array is ", testScore[i]
MAX = 3
testScore = [4, 7, 1]
iPtr = testScore
for i in range(MAX):
print "The address of index ", i, " of the array is ", id(iPtr[i])
print "The value at index ", i, " of the array is ", iPtr[i]
MAX = 3
testScore = [4, 7, 1]
iPtr = testScore
for i in range(MAX):
print "The address of index ", i, " of the array is ", id(iPtr[i])
print "The value at index ", i, " of the array is ", iPtr[i]
import sys
MAX = 3
testScore = [4, 7, 1]
iPtr = testScore
i = 0
while (id(iPtr[MAX-1]) <= id(testScore[MAX-1])):
try:
print "The address of index ", i, " of the array is ", id(iPtr[i])
print "The value at index ", i, " of the array is ", iPtr[i]
i += 1
except IndexError:
print "\n\nEnd of program"
sys.exit()
import sys
MAX = 3
testScore = [4, 7, 1]
iPtr = id(testScore[MAX-1])
i = MAX - 1
while (iPtr >= id(testScore[0])):
print "The address of index ", i, " of the array is ", iPtr
print "The value at index ", i, " of the array is ", testScore[i]
i -= 1
if i < 0:
break
MAX = 3
def assignValues(tests, num):
for i in range(num):
print "Enter test score #", i + 1, ": ",
tests.append(int(raw_input()))
def displayValues(scores, elems):
for i in range(elems):
print "Test score #", i + 1, ": ", scores[i]
testScore = []
assignValues(testScore, MAX)
displayValues(testScore, MAX)
MAX = 3
def assignValues(tests, num):
for i in range(num):
print "Enter test score #", i + 1, ": ",
tests.append(int(raw_input()))
def displayValues(scores, elems):
for i in range(elems):
print "Test score #", i + 1, ": ", scores[i]
testScore = []
assignValues(testScore, MAX)
displayValues(testScore, MAX)
def doubleIt(x):
print "The number to be doubled is ", x
x *= 2
print "The number doubled in doubleIt is ", x
print "Enter number: ",
num = int(raw_input())
doubleIt(num)
print "The number doubled in main is ", num
def doubleIt(x):
print "The number to be doubled is ", x
x *= 2
print "The number doubled in doubleIt is ", x
print "Enter number: ",
num = int(raw_input())
doubleIt(num)
print "The number doubled in main is ", num
print "Enter the number of test scores: ",
numTests = int(raw_input())
iPtr = []
for i in range(numTests):
print "Enter test score #", i + 1,": ",
iPtr.append(int(raw_input()))
for i in range(numTests):
print "Test score #", i + 1, " is ", iPtr[i]
str = "Jeff Kent"
print str
def setName():
print "Enter your name: ",
name = raw_input()
return name
str = setName()
print str
def setName():
print "Enter your name: ",
name = raw_input()
return name
str = setName()
print str
def setName():
print "Enter your name: ",
name = raw_input()
return name
str = setName()
print str