CPSC 203: Introduction to computers |
What is the output of the program show below with the inputs:
(a) 0
(b) 20000
(c) 20001
(d) 40000
(e) 100000
def start (income):
taxCredit = 0
taxRate = 0
taxPaid = 0
afterTaxIncome = 0
if (income >= 0) and (income
<= 20000):
if (income > 20000) and (income <= 50000):
taxRate = 0.2if (income > 50000):
taxRate = 0.3
taxPaid = income * taxRate;What is the output of the following program:
def fun1 (num1, num2):
num1 = num1 * 10
num2 = num2 * 20
print num1, num2
def start ():
num1 = 1
num2 = 2
print num1, num2
fun1 (num1, num2)
print num1, num2
For the program shown below you are to write a function 'swap' so that the contents of variable 'num1' and 'num2' are swapped.
def start ():
num1 = 11
num2 = 17
print num1, num2
num1, num2 = swap (num1, num2)
print num1, num2
|
||
|
||
|
||
| ||
|
||
|
||
|
||
def start (): ch = 'X' print 'ch', ch |
||
|
||
|
||
for i in range (0, 10, 1): | ||
|