Nursing 440
April 5, 2020
Narcissism” assessment
April 5, 2020

Using Loops In Python

In Python, create a program in Jython IDE (https://www.jython.org/download) or online IDE (https://repl.it/languages/python) that meets the following requirements:

  • Take two integers from the user. (Be sure to check for integer. If input is not an integer, shows an error message.
  • Save the lower number as x.
  • Save the largest integer as y.
  • Write a loop that counts from x to y by twos.
  • Print out the values of that loop using the Print function in Python.
  • Write another code section that adds x and y, and saves the value as Z.
  • Print out the values of Z using the Print function in Python.

For example: (integer inputs) 

Enter first number:

12

Enter second number:

Increment by 2 

4

6

8

10

12

sum is 16

For example: (non-integer input)

Enter first number:

12

Enter second number:

abc

Not an integer value…Good Bye

Provide the code and take a screenshot of the output, then paste the screenshot(s) into a Microsoft® Word document.

Review Chapters 6 and 11 of Python for Everyone if you have additional questions on creating a program in Python

 

"Is this question part of your assignment? We Can Help!"

Essay Writing Service