Answer:
A variable is a name associated with a data value; we say that the variable "stores" or "contains" the value. Variables allow us to store and manipulate data in our programs.
Answer:
A linear search is one that scans every record/file until it discovers the value being searched for.
Binary search, on the other hand, is also known as <em>Logarithmic search</em>. It is used to locate the position of a value inside an array that has already been sorted.
The linear search will return the lowest value faster than the binary search when small arrays are involved.
This will only be feasible when the array is sorted prior.
Cheers!
The toll program illustrates the use of conditional statements;
As a general rule, conditional statements are used to make decisions
<h3>The
toll program</h3>
The toll program written in Python where conditional statements are used to make several decisions is as follows:
def calc_toll(hour, morning, weekend):
toll_fee = 0
if weekend == False:
if morning == True:
if hour < 7:
toll_fee+=1.15
elif hour < 10:
toll_fee+=2.95
elif hour <= 12:
toll_fee+=1.90
else:
if hour < 3:
toll_fee+=1.90
elif hour < 8:
toll_fee+=3.95
elif hour >= 8:
toll_fee+=1.40
else:
if morning == True:
if hour < 7:
toll_fee+=1.05
elif hour <= 12:
toll_fee+=2.15
else:
if hour < 8:
toll_fee+=2.15
elif hour >= 8:
toll_fee+=1.10
return toll_fee
Read more about conditional statements at:
brainly.com/question/24833629
#SPJ1
The Magnetic attraction will decrease