logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Trace by hand the execution of the following program, by completing the trace table

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

important notes:

Each assignment will come in two parts (Part A and Part B – each covering various chapters/concepts), and several question solutions from each part must be submitted to the corresponding Assignment dropbox, available from the Assessment menu in Brightspace. Not all question solutions will be graded. Each week the course instructors will select a single question from each part to be graded by the markers. Feedback will be given only on those two select questions and your marks will be based on those two questions only. The other submissions will not be graded and you will not be told, ahead of time, which questions will be graded. In order to ensure full opportunity to achieve the best grade, you should submit all questions labelled as (this question MAY BE GRADED) below. The graded question will be identified in the feedback for the assignment. Some questions are labelled as (this question will not be graded) and hence you do not need to submit this question at all, but it is still a good idea to complete it to understand the concepts.

While doing your assignment you can get help by posting your questions in the appropriate folder in the discussion forum to get help from your fellow students, the instructor and the instructional staff. You should also read other posts there since this may help with your questions.

Completing the assignments will help you to gain hands on experience with coding in Python and understand the learnt concepts well enough so that you can apply the concepts to solve and code the solution for the given problems. All of this will help you in doing well on your tests and exam.

Solutions to these assignments will not be posted but you will get feedback on a portion of your assignment submission.

While coding solutions for the problems given below, keep in mind that on the quizzes/tests/exams you will also be marked on the following:

o efficient solution of the problem. A given problem can be solved in number of different ways, but the best solution is the one that is efficient; i.e., the one that uses the right concepts in a very productive way.

o including sufficient descriptive comments in your program. The person looking at your code should be able to understand how your code is solving the given problem even if the person reading your Python program does not know the Python language. In addition, the reader of your program should be able to understand what each variable represents.

o labelling of input and output. All input/output should have a descriptive label so that the reader of your program understands what input is expected and what output the program has generated.

o program style - consistent formatting and indentation of program statements, meaningful variable names (identifiers) and the use of constants (constant identifiers), where appropriate.

o Note that sometimes, even though your code can generate the expected output, it may still not be correct as it may work for a specific data set and not for all valid data sets. Also, it may not use the programming concepts and best practices that we have emphasized in the course.

Practicing these rules will build a good foundation for programming.

This assignment is based on Chapter 4 of the text, excluding the graphics components from the chapter. Please use concepts from Chapters 1 – 4, including the following concepts:

o counter-controlled repetition structures using

for loop with range function

while loop with conditional expressions that use the concept of a counter

 

o condition-controlled repetition structures using a while loop with conditional expressions that use the concepts of flags/sentinel values

o conditional expressions that could be

simple relational expressions

compound logical expressions

o nested repetition structures

o IMPORTANT: DO NOT USE the break (text page 138) or continue statements even though these are valid Python statements.

Please use only the concepts/structures/functions, etc. that we cover in the course. Using advanced concepts/structures/functions that we do not cover in the course may cause you to lose marks since each assignment/problem is testing that you understand specific concepts.

Assignments are to be done individually. The solutions that you submit must be your own work.

Posting of assignment questions to homework websites is not permitted.

 

With this understanding please complete the following questions:

 

Question 1 (a) – (this question will not be graded)

Trace (by hand) the execution of the following program, by completing the trace table below, for any lines of code that are labelled with line numbers. The first line has already been filled in for you. Use the following input values (in this order, some inputs may not need to be used): 9 8 27 10 15

 

LIMIT = 3 #LINE 1

yes = 0 #LINE 2

no = 0 #LINE 3

for i in range(LIMIT, 0, -1): #LINE 4 isIt = int(input("Enter the input value: ")) #LINE 5 if isIt % LIMIT == 0: #LINE 6 yes += 1 #LINE 7

else:

no += 1 #LINE 8

print("Number of yes:", yes) #LINE 9

print("Number of no:", no) #LINE 10

 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

511 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

653 Answers

Hire Me
expert
Husnain SaeedComputer science

761 Answers

Hire Me
expert
Atharva PatilComputer science

738 Answers

Hire Me