Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Videos

Question
Book Icon
Chapter 6, Problem 11PE
Program Plan Intro

Program to display the square of the numbers

Program plan:

  • The function named “squareEach()” is defined and inside the “squareEach()”,
    • Initialize the for loop that ranges till the length of the array
      • The required variable is declared and stores the array of numbers that have been squared.
      • Return the value stored in the variable “nums”
  • In the “test()” function,
    • Declare an array variable and initialize it with an array.
    • Call the method named “squareEach()” to square the numbers in the given array.
    • Print the output value stored in the array variable “y”.
  • Call the function “test()”.

Blurred answer
Students have asked these similar questions
C++ Coding: ArraysTrue and False Code function definitions for eoNum() and output(): Both eoNum() and output() are recursive functions. output() stores the even/odd value in an array. Store 0 if the element in the data array is even and store 1 if the element in the data array is odd. eoNum() displays all the values in an array to the console.
Python please!   Generalized image blender function   Create a function blend images() which takes multiple RGB images as an input, and outputs a blended image.   The function should accept following parameters 1. image list- A Python list of 3D arrays where each 3D array corresponds to an RGB image 2. weight list-A Python list of float values between (0, 1) corresponding to the pixel weight to be given to each image-e.g. [0.2, 0.3, 0.1, 0.4] for 4 images. The sum of the weights should be equal to 1.   Test your function against a provided list of 5 images with following weight lists (i.e. 2 blended images) [0.2, 0.2, 0.2, 0.2, 0.2]- blend all 5 images [0.2, 0.3, 0.5]- blend first 3 images NOTE: DO NOT USE pre-existing image blending functions.
c++ hw In this hw, you're going to be working with partially filled arrays that are parallel with each other. That means that the row index in multiple arrays identifies different pieces of data for the same person. This is a simple payroll system that just calculates gross pay given a set of employees, hours worked for the week and hourly rate. code format: // TODO: Add function prototypes for all the declared functions // TODO: Declare two functions to compute the highestPay and lowestPay// HINT: Each should return the index of the correct value in the grossPay array. /* TODO: Create a function calledgetEmployeeNames   Arguments :       Name array(first and last name)       Maximum size       Return the number of names filled.*/ /* TODO: Create a function calledgetHourlyPay   Arguments :       NameArray(filled in Step 1)       HourlyPayArray(starts empty)       NumberOfNamesFilled(from Step1)*/ int main(){   // TODO: Declare an array of strings for the employeeNames able to hold a…
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License