• Question 1
  • Question 2
  • Question 3
  • Question 4
  • Question 5
  • Question 6

Question 1

list_variable = [100, 144, 169, 1000, 8]

Write a Python code that uses print() and max() functions to print out the largest value in the list, list_variable, as follows:

The largest value in the list is: 1000
The smallest value in the list is: 8




Question 2

fare = "$10.00"
tip = "2.00$"
tax = "$ 0.80"

Write a Python code that uses slicing and the print() function to print out the following message:

The total trip cost is: $12.80




Question 3

x = 4.0
y = .5

For each expression below, what is the value of the expression? Explain thoroughly.

20 == '20'
bool(0) != bool('')
x < y or 3*y < x
not (100 == '100' and 25 < 36)




Question 4

This Python code creates a tuple with seven different ages:

respondent_ages = (65, 29, 25, 35, 58, 23, 19)

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].




Question 5

tuple_var = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
total = 0

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)




Question 6

Write a Python code that uses a while-loop and the print() function to print out the following message 5 times:

Programming for Data Analytics is so fun!