Chapter 2
|
Section 2.1 |
|
60054
|
An algorithm allows
ambiguity. The PROGRAMMER solves the PROBLEMS of a USER by expressing an ALGORITHM in a PROGRAMMING LANGUAGE to make a PROGRAM that can run on a COMPUTER. |
|
60183 |
logical, OR, logic,
OR, semantic |
|
Section 2.3 |
|
|
51833 |
"!!!!!" |
|
51835 |
"" |
|
Section 2.5 |
|
|
51001 |
seven=7 |
|
51014 |
precise=1.09388641 |
|
51019 |
eight=7 |
|
51013 |
temperature=98.6 |
|
51043 |
length=3.5, width=1.55 |
|
51093 |
grad_age = matric_age + 4 |
|
60182 |
variable |
|
60098 |
None of the above |
|
60108 |
________ (the underscores do not break the rules for the names of
variables or legal identifiers) |
|
60106 |
7thheaven (variables cannot begin with a digit) |
|
85016 |
QUESTION 1: hasFever, QUESTION 2: mightBePrime |
|
60110 |
monthlyPay |
|
51887 |
foreground = "red" |
|
51952 |
foreground = "black" |
|
51888 |
text = "" |
|
51923 |
empty="" |
|
51886 |
background =
"white" |
|
51168 |
itemp
= i |
|
51169 |
i,j = j,i |
|
51170 |
temp = first_place_winner |
|
51171 |
best_value,second_best_value = second_best_value,
best_value |
51124 |
print(count) |
51125 |
print(fraction) |
51126 |
print("i=" + str(iVal), "f=" + str(fVal)) |
| Section 2.6
|
|
51127 |
k=input() d=input() s=input() print(s, d, k) print(k, d, s) |
|
Section 2.7 |
|
|
51872 |
large + small |
|
51029 |
verbal_score + math_score |
|
51030 |
taxable_purchases + tax_free_purchases |
|
51031 |
ending_time - starting_time |
|
51032 |
full_admission_price - discount_amount |
|
51033 |
price_per_case * 12 |
|
51034 |
cost_of_bus_rental / max_bus_riders |
|
51035 |
principal % divisor |
|
51036 |
avg = (12 + 40) / 2 |
|
51044 |
total1+total2 |
|
51045 |
sales_summer-sales_spring |
|
51046 |
total_weight-weight_of_box |
|
51048 |
price*total_number |
|
51047 |
total_weight/quantity |
|
51249 |
g = h * h |
|
51037 |
(exam1 + exam2) / 2 |
|
51020 |
avg = (a+b+c)/3.0 |
|
51023 |
bmi = 703.0 * w / h**2 |
|
51871 |
length1 * width1 + length2 * width2 |
|
51873 |
(large + small)*(large + small) |
|
51875 |
1.0 + 1.0/2.0 + 1.0/3.0 + 1.0/4.0 + 1.0/5.0 + 1.0/6.0 + 1.0/7.0
+ 1.0/8.0 |
|
51876 |
hn + 1.0/(n+1) |
|
51880 |
price%100 |
|
51881 |
x%10 |
|
Section 2.8 |
|
|
60102 |
QUESTION 1: \n, QUESTION
2: \t, QUESTION 3: \', QUESTION 4: \", QUESTION 5: \\ |
51131 |
josh = input() cindy = input() me = input() print( (int(josh)+int(cindy)+int(me))/3) |