Python Average Of Two Lists
Python: Compute boilerplate of two given lists
Python List: Do - 105 with Solution
Write a Python program to compute average of two given lists.
Sample Solution:
Python Code:
def average_two_lists(nums1, nums2): issue = sum(nums1 + nums2) / len(nums1 + nums2) render outcome nums1 = [1, i, 3, 4, 4, 5, vi, vii] nums2 = [0, 1, 2, 3, 4, 4, 5, 7, eight] impress("Original listing:") print(nums1) print(nums2) impress("\nAverage of two lists:") print(average_two_lists(nums1, nums2)) Sample Output:
Original list: [i, 1, 3, iv, 4, v, six, vii] [0, one, 2, three, 4, 4, v, vii, 8] Average of two lists: three.823529411764706
Flowchart:
Visualize Python lawmaking execution:
The following tool visualize what the calculator is doing step-by-step as it executes the said plan:
Python Code Editor:
Have some other mode to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to find the difference between consecutive numbers in a given listing.
Next: Write a Python plan to count integer in a given mixed listing.
What is the difficulty level of this exercise?
Python: Tips of the Day
Reversing an iterable with lodge (cord, listing etc.):
# Reversing cord >>> s = "xyz" >>> s[::-1] "zyx" # Reversing listing >>> fifty = ["x", "y", "z"] >>> 50[::-1] ["z", "y", "ten"]
Python Average Of Two Lists,
Source: https://www.w3resource.com/python-exercises/list/python-data-type-list-exercise-105.php
Posted by: todaroyouthe.blogspot.com

0 Response to "Python Average Of Two Lists"
Post a Comment