Question

Write a Python expression that uses the list even_numbers below and evaluates to the list [4]....

Write a Python expression that uses the list even_numbers below and evaluates to the list [4].

or produces the list to [4]

even_numbers = [0, 2, 4, 6, 8, 10, 12] 

Homework Answers

Answer #1

#to prodduce list till element 4
even_numbers[:3]#[4] is element number 3, and at index 2. So we need to select indices 0,1,2
#in [:3], 3 is exclusive. It means all posible indices less than 3, which are 0,1,2

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
For the below Python expression: Evaluate the expression Show the PROCESS for how Python evaluates the...
For the below Python expression: Evaluate the expression Show the PROCESS for how Python evaluates the expression (order of operations and showing the steps Python takes to evaluate the problem).   3 % 3 * 14 == 18.2 / 8.1 and 3.1 + 15.7 * 19.1 >= 6.6 // 18 // 15.0
Please use Python 3 4). Write a program that asks the user to enter 10 numbers....
Please use Python 3 4). Write a program that asks the user to enter 10 numbers. The program should store the numbers in a list and then display the following data: • The lowest number in the list • The highest number in the list •The total of the numbers in the list • The average of the numbers in the list   Sample input & output: (Prompt) Enter Number 1: (User enter) 4 (Prompt) Enter Number 2: (User enter) 7...
1. What will the following python code display? num = list(range(5)) print(num) 2. Answer the following...
1. What will the following python code display? num = list(range(5)) print(num) 2. Answer the following questions using the list below. You can record your answers in the essay textbox. data = [5,3,7] A. Write code to replace the value in the 0 position with the number 8. B. Add the value 10 to the end of the list. C. Insert the value 22 after position 1 in the list. D. Remove the value at position 2. E. Sort the...
write a python program that include a function named activity_selection() and take in two arguments, first...
write a python program that include a function named activity_selection() and take in two arguments, first one would be the number of tasks and the second argument would be a list of activities. Each activity would have an activity number, start time and finish time. Example activity_selection input and output: activity_selection (11, [[1, 1, 4 ], [2, 3, 5], [3, 0, 6], [4, 5, 7], [5, 3, 9], [6, 5, 9],[7, 6, 10], [ 8, 8, 11], [ 9, 8,...
Write a Python function count_bigger that takes two parameters, a nested list of objects and a...
Write a Python function count_bigger that takes two parameters, a nested list of objects and a threshold number. It returns an integer specifying how many of the objects anywhere in the nested list are numbers that are larger than the threshold. (For our purposes, "numbers" are either integers or floats.) There may be objects in the list other than numbers, in which case you would simply ignore them. Here are a couple of examples of how the function should behave...
Question1: Write a Python Program that asks for the grades of 5 quizzes and then prints...
Question1: Write a Python Program that asks for the grades of 5 quizzes and then prints the highest grade. [6 Marks] Question2: Write a Python Program that does the following tasks. [8 Marks] Create an empty list Ask the user for 5 positive numbers and append them to the list Find and print the sum of all the numbers in the list Delete the last element from the list and then print the list Question3: Consider you have the following...
(Python Programming) Write a program that prompts a user for a positive integer and then uses...
(Python Programming) Write a program that prompts a user for a positive integer and then uses a loop to calculate and display the sum of specific fractions as follows: Let's say the user enters 5, then your program will compute: 1/5 + 2/4 + 3/3 + 4/2 + 5/1 which is 8.7.
this is in python 3.6 Write a program that prints to three significant figures the values...
this is in python 3.6 Write a program that prints to three significant figures the values of x and g(x) from x = 0 to x = 10 in increments of 2 units. The values of x include 0 and 10. The function g(x) is defined below: g(x): sqrt(x); x<4    sqrt(4); 4<=x The output of the first and last values are below: 0.000 0.000 ... ... 10.000 2.000
(Python 3) If I have a list of keys and 3 lists of values, how can...
(Python 3) If I have a list of keys and 3 lists of values, how can I append these values into an existing key, value pair in a dictionary? Say I have: mykeys = ["John", "Sarah", "Lexi, "Cass"] values1 = [3, 5, 2, 6] values2 = [17, 18, 12, 21] values3 = [4, 7, 3, 0] How can I make it so my dictionary contains all three values in each of the keys. i.e.: {"John" : [3, 17, 4], "Sarah":...
Write a function count_div5(nested_list) that takes in a list of lists of integers, and returns a...
Write a function count_div5(nested_list) that takes in a list of lists of integers, and returns a list of integers representing how many integers in each sublist of the original were divisible by 5. Examples: >>> count_div5([[5, 3, 25, 4], [46, 7], [5, 10, 15]]) [2, 0, 3] >>> count_div5([]) [] >>> count_div5([[-20, 10, 2, 4, 5], [], [5], [8, 25, 10], [6]]) [3, 0, 1, 2, 0]
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • On December 21, 2017, Grouper Company provided you with the following information regarding its equity investments....
    asked 13 minutes ago
  • IN C#, which of the following statements correctly instantiates an array which is defined as a...
    asked 18 minutes ago
  • You are being asked to obtain the length of a vertical curve for the following situation:...
    asked 1 hour ago
  • Living organisms are highly structured, and therefore much lower in entropy than the substances from which...
    asked 1 hour ago
  • When using a cantilevered reinforced concrete slab the equation to solve the coefficient of resistance is...
    asked 1 hour ago
  • Question 1: True/False/uncertain For each statement, state whether you think it is True, False or Uncertain...
    asked 2 hours ago
  • Design a database with the following tables Table name: Customer customer_id lastname firstname phone c10001 Smith...
    asked 2 hours ago
  • Consider a simply supported one-way slab over a 15ft span, 6in thick with #5 bars at...
    asked 2 hours ago
  • Would you expect the following reactions to be spontaneous? (Hint entropy and enthalpy affect spontaneity. a....
    asked 2 hours ago
  • The coil in the figure carries current i = 1.58 A in the direction indicated, is...
    asked 2 hours ago
  • Liquidation Southwestern Wear Inc. has the following balance sheet: Current assets $1,875,000 Accounts payable $375,000 Fixed...
    asked 2 hours ago
  • PART III – Final Model Interpretations - Answer the following questions about your best model. Least...
    asked 3 hours ago