Arithmetic operators · 18 / 18 Exercise Medium

Calculate values of a function

Objective

Create a program Python to display certain values of the function y= x2 - 2x + 1. Ask the user for the range of integers x to show the function.

Instructions

  1. Ask the user for the range of integer numbers x.
  2. Calculate the values of the function (y= x2 - 2x + 1) for each x in the range.
  3. Display the results of the function for each x.
Input
-10
10
Output
121 100 81 64 49 36 25 16 9 4 1 0 1 4 9 16 25 36 49 64 81

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise