= [100, 144, 169, 1000, 8] list_variable
Write a Python code that uses print()
and
max()
functions to print out the largest value in the list,
list_variable
, as follows:
= "$10.00"
fare = "2.00$"
tip = "$ 0.80" tax
Write a Python code that uses slicing and the
print()
function to print out the following message:
= 4.0
x = .5 y
For each expression below, what is the value of the expression? Explain thoroughly.
20 == '20'
bool(0) != bool('')
< y or 3*y < x
x not (100 == '100' and 25 < 36)
This Python code creates a tuple with seven different ages:
= (65, 29, 25, 35, 58, 23, 19) respondent_ages
Write a Python code that uses a for-loop statement and a
if-else statement to assign the list,
under40_list
, to [29, 25, 35, 23, 19]
and the
list, over40_list
, to [65, 58]
.
= (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
tuple_var = 0 total
Write a Python code that uses the following two lines (1) a
for-loop statement to process each element of
tuple_var
and (2) the following line.
print("The total of the values in the tuple is: ", total)
Write a Python code that uses a while-loop and the
print()
function to print out the following message 5
times: