Question

You recently graduated college and you are applying for a programming job that requires the understanding...

You recently graduated college and you are applying for a programming job that requires the understanding of loops in Python. The manager you are interviewing with has asked you to take an assessment to prove your programming knowledge. Below are the requirements for the programming skills test.

In Python, create a program that meets the following requirements:

Take two integers from the user.

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 loop that adds x and y, and saves the value as Z.

Print out the values of Z using the Print function in Python.

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Here a new python program with name "main.py" is created, which contains following code.

main.py :

#asking user number 1
number1=int(input("Enter number 1 : "))
#asking number 2
number2=int(input("Enter number 2 : "))
#declaring variables
x=0
y=0
#checking number
if(number1>number2):
x=number2 #set value of x
y=number1 #set value of y
else:
x=number1
y=number2
count=0 #variable to store count
for i in range(x,y+1,2):
print(i,end=' ')#print value of i
count=count+1 #increment count
print("Count : ",count) #print count
for i in range(x,y+1,1):
z=i+y #add values of x and y
print(z,end=' ') #print value of z

Screen for Indentation :

main.py 1 #asking user number 1 number1-int (input (Enter number 1 )) 3 #asking number 2 4 number2-int (input (Enter numbe

======================================================

Output : Compile and Run above program to get the screen as shown below

Screen 1 :main.py

input Enter number 1 10 Enter number 2 2 2 4 6 8 10 Count 5 12 13 14 15 16 17 18 19 20 . Program fini shed with exit code 0 P

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
You recently graduated college and you are applying for a programming job that requires the understanding...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You recently graduated college and you are applying for a programming job that requires the understanding...

    You recently graduated college and you are applying for a programming job that requires the understanding of loops in Python. The manager you are interviewing with has asked you to take an assessment to prove your programming knowledge. Below are the requirements for the programming skills test. In Python, create a program that meets the following requirements: Take two integers from the user. Save the lower number as x. Save the largest integer as y. Write a loop that counts...

  • Give a problem statement that requires you to develop a Python program that meets the following...

    Give a problem statement that requires you to develop a Python program that meets the following requirements (2 EC points) The program reads data from a text file and then assigns it to a string variable (2 EC points) The program defines and calls at least one function other than main() (2 EC points) The program uses a multi-way branch (if, followed by a number of elifs, followed by else) (2 EC points) The program uses a loop (for loop...

  • Piggy back on the programming project one you completed in module 3. You will use some...

    Piggy back on the programming project one you completed in module 3. You will use some of those concepts here again. We will be building this project inside out, start individual quiz and use a for loop to repeat it three times for three students. In this program you will be required to write a python program that generates math quizzes for students in second grade. Your program should do the following Ask the student for their name Provide 3...

  • C Programming only. (NO C++) Copy & paste all source code with your answer. Also take...

    C Programming only. (NO C++) Copy & paste all source code with your answer. Also take screenshot of it compiled. 11. Write a program with the following software architecture int main) void ReadX/ OuT */ Ant *x) void IncrementX4Times(/t IO */ int *x) void Printx(/*IN */ int x) such that (1) the function ReadX) is called by the function main0 to input the value for main0 variable x from the program user as shown in the screenshot below; (2) IncrementX4Times0...

  • PLEASE USE WHILE LOOP (NOT FOR LOOPS). Python programming. In this problem, you should write one...

    PLEASE USE WHILE LOOP (NOT FOR LOOPS). Python programming. In this problem, you should write one function named multiply. This function should accept one parameter, which you can assume will be a list with one or more integers in it. (If you don’t know what I mean when I say “list of integers”, go do the reading!) The function should loop through all of the numbers in the list, and multiply all of the numbers together. It should return the...

  • Python 2.7.14 Programming Assignment Shape Drawing With Notepad++(PLEASE READ AND FOLLOW THESE INSTRUCTIONS THOROUGLY AS THIS...

    Python 2.7.14 Programming Assignment Shape Drawing With Notepad++(PLEASE READ AND FOLLOW THESE INSTRUCTIONS THOROUGLY AS THIS ASSIGNMENT IS FOR PYTHON 2.7.14. ONLY AND I REALLY NEED THIS TO WORK!!! ALSO PLEASE HAVE THE CODE PROPERLY INDENTED, WITH WHATEVER VARIABLES DEFINED, WHATEVER IT TAKES TO WORK FOR PYTHON 2.7.14. I feel like nothing I do is working and I'm trying everything I can think of. ): In this assignment, the student will create a Python script that implements a series of...

  • This problem demonstrates the use of import module. The Python programming language has many strengths, but...

    This problem demonstrates the use of import module. The Python programming language has many strengths, but one of its best is the availability to use many existing modules for various tasks, and you do not need to be an experienced computer programmer to start using these modules. We have given you some incomplete code; note that the very first line of that code contains an import statement as follows: import math This statement enables your program to use a math...

  • Use Octave 5:04 < Back HW06-Ch04.doc Homework Assignment #6 Due Date: 04/24/2020 Late Penalty: 10%/day +)(45%)...

    Use Octave 5:04 < Back HW06-Ch04.doc Homework Assignment #6 Due Date: 04/24/2020 Late Penalty: 10%/day +)(45%) Use of the if-elseif-else statements. Given the following function: lag) for 10 (30%) Use Octave to define a function called myFun01. The function myFun01 should take x as an argument and return y to the caller. b.(15%) Use the function you defined in Parta) to compute y using Octave for three different values of XX=-10, x=5,x= 10. You should not use any of the...

  • Need some help I am not understanding this programming class at all. We are using Microsoft...

    Need some help I am not understanding this programming class at all. We are using Microsoft visual studio with python in console mode to complete these labs. Double-click to hide white space CIS115 Week 4 Lab Overview Title of Lab: Multiplication Table in Python Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to...

  • Python Programming Chapter 5 Programming Exercise Dinner Selection Program (60 points total) Pseudocode (10 points) As...

    Python Programming Chapter 5 Programming Exercise Dinner Selection Program (60 points total) Pseudocode (10 points) As the family cook, you know that the toughest question of the day is "What's for dinner?" You For decide to write a program to help you do days of meal planning for the entree, side and dessert. You will need to use random numbers and functions to complete the project. What's Dinner? • • • Start with a pseudocode (10 points). Write the pseudocode...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT