Search for question
Question

Your submission for this assignment must include your full name and your official nine-digit Carleton University student number as

a comment at the top of the source file you submit. For this assignment, you will be submitting two files. One of these files will

be a source code file (that must be written using only the Python 3 programming language) and this file must be named:

101289,

938

comp1405_f23_101289389_assignment_02.py

The other file you will be submitting is a printout of this document, onto which you have written some values. This component of

the assignment ensures that you have carefully considered each operation involved in your assigned process and helps you design

some test cases that you can use to verify your work. You can create create a printout of this document by pressing the "Print"

button in the top right corner. Once you have written your values onto the printout, take a scan or a digital photograph and then

create a "zip" file of your source code submission and your completed printout.

Officially, the due date for this assignment has been set for Friday, September 22, 2023, at 11:59 pm EST, but it is important to

note that any late submissions will still be accepted without penalty until Sunday, September 24, by 11:59 pm EST.

389

1012

For this assignment, you will use some of what you have learned about the pipeline design pattern, data types and arithmetic

operators in Python, the different ways to receive user input, and how to read code documentation, in order to design an implement

a program that will reproduce a process that has been generated specifically for you. Your assigned process has been used to

generate a diagram of a pipeline that specifies, at each stage, what variables names to use, what operations to perform, and when

(and how) to receive input from or produce output for the user. °89 407.

If your submission crashes (i.e., terminates with an error) on execution, imports any library other than "sys" (which is required

for accessing command-line arguments), or is not received by the Sunday cutoff deadline, then it will receive a mark of 0.

28938

code 1289 ubmi

101289389

Your assigned image is specific to your student number and must be kept strictly confidential. Posting these files online or

sharing them with anyone other than the instructors or teaching assistants will be considered academic misconduct.

101289389 101289389

101289389

101289389

1012

1012

389

Starting at the left side of your diagram, you will see where the initial value will enter the pipeline and the variable name you

must use. Proceeding from left to right, you will see arithmetic operations with constant values (e.g., "add 2 to the number in

the pipeline"), arithmetic operations with additional inputs (e.g., "subtract the value of a command line argument from the number

in the pipeline"), and output instructions (e.g., "print the value in the pipeline with a dollar sign"). Before you begin your

implementation, ensure that you have completed the "fill-in-the-blanks" section of the assignment, and remember the following:

101289389

1012

an integer received by using

a call to the input function

and stored in a variable

r

389

101289389

The result of subtracting the value X *from* the value Y is the result of the operation Y-X.

10.

101289389

ed 389

The result of "floor dividing" the value X by the value Y is the result of long dividing X by Y and then discarding the remainder.

The result of a "modulo" of the value X by the value Y is the result of long dividing X by Y but keeping only the remainder.

The "ord" function can be used to convert a character to an integer (by providing its index on the ASCII table)

389

The "round" function can be used to round a floating-point number to the specified position index.

101289389

1012893

101

101289389

101289389

101289389 101289389

101289389

101289389

Choose a random positive integer

less than 20 and write it here.

389

101289389

101289389

386912389

101289389

101289389

101289388

101

101289389

101289389

101289389

128

101289389

101289389

101289389

101289389

101289389 101289389

10128

101289389

39389

289389

101289389

101289389

101289389

101289389

101289389 101289389

101289389

101289389

107

Choose a random positive integer

less than 20 and write it here

101289389

101289389

101289389

1012

101289389

101289389

201289389

101289389

101289389

101289389

101282

101

101289389

012

101289389

39389 101289389

101289389

101289389

10289389

101289389

0128389

101289389

1289 89

101289389

101289389

101289389

101289389

Choose a random positive integer

less than 20 and write it here.

101289389

101289389

10128

28

101289389

101289389

101289389

01289389

101289389

10128.

89

012892

10128 (as

89

Below are four copies of your assigned pipeline, to which you must (as noted above) "fill-in-the-blanks". Failure to complete this

section of the assignment will result in a significant penalty.

¹89389

101289389

101289389

1012

Choose a random positive integer

less than 20 and write it here.

101289389

101289389

1012

101289389

101289389

101289389

3891012

101289389

101289389

101289389

101289389

101289389

101289389

289389

101289389

101280289

101289389

1012800

1069389

89

101289389

101289389

101289389

101289389

101289389

101289389 101289389 101289389

101289389

101289389

101289389

101289389

101289389

101289389

10128

a character

received by using

a command-line

argument

128

converted to an

integer and stored.

in a variable

f

101289389

101

multiply the

number to the left

and the number

received above

Check your assigned

pipeline for if this

should be a real or a

character and either

write a random real

(noninteger) value or a

random letter and the

integer to which it

will be converted

1012

101289389

101280

01289389

101289389

2892

number

$89

multiply the

to the left.

and the number

received above.

10128938

89

assigned

Check your

pipeline for if this

should be a real or a

character and either

write a random real

(noninteger) value or a

random letter and the

integer

to which it

will be converted

multiply

the

number to the left.

and the number

received above

20122

101289389

101289389

389

multiply the

number to the left

and the number

received above

89389

10122

Check your assigned

pipeline for if this

should be a real or a

character and either

write a random real

value or a

random letter and the

(noninteger)

integer to which it

will be converted

389

multiply the

number to the left.

and the number.

received above

10128

a real number

received by using

a call to the

input function

9389

converted to an

integer and stored.

in a variable

n

30

floor divide the

number to the left.

by the number

received above

Check your assigned.

pipeline for if this

should be a real or a

character and either

write a random real

(noninteger) value or a

random letter and the

integer to which it

will be converted

389

floor divide the

number to the left

by the number

received above

Check your assigned

pipeline for if this

should be a real or a

character and either.

write a random real

(noninteger) value or a

random letter and the

integer to which it

will be converted

floor divide the

number to the left

by the number

received above

Tog

20122

10128938

89

Check your assigned

pipeline for if this

should be a real or al

character and either.

write a random real

(noninteger) value or a

random letter and the

integer to which it

will be converted

1289 ues

9389201 389401289389

Check your assigned

pipeline for if this

should be a real or a

character and either.

write a random real

value or a

random letter and the

integer to which it.

(noninteger)

will be converted

floor divide the

number to the left

by the number

received above

10122

1012

89389 the blank 289389

389

289389

128

Check your assigned

pipeline for if this

should be a real or a

character and either

write a random real

(noninteger) value or a

random letter and the

integer to which it

will be converted

10128

389

floor divide the

number to the left.

by the number

received above

01289389

9389

01289389

101289389

10129

10128889

print the value.

in the pipeline

in round brackets

e.g., (123)

01289389

10128

101289389

Check your assigned

pipeline and write the

output

formatted

here

&

be12893

9389

01289389

10128

Check your assigned

pipeline and write the

formatted output here.

01289389

101289388

89

▼80

Check your assigned

pipeline and write the

formatted output here

10122

01289389

1012892

389

10128

107

9389

101289389

Check your assigned

pipeline and write the

formatted output here

1012

389

print the value

in the pipeline

with a dollar sign

e.g., $123

01289389

101289389

1012

101289389

101289389

389

289380

10128

101289389

389

289389

101289389

101289389

910128

10

101289389

1012

I

Check your assigned

pipeline and write the

formatted

output

here

101289389

101289389

201289389

101

101289389

101289389

Check your assigned

pipeline and write the

formatted

output

here

101289389

101289389

101289389

9389

101289389

101289389

Check your assigned

pipeline and write the

formatted output

here

101289389

10122

101289389

101289389

101289389

101289380

89

Check your assigned

pipeline and write the

formatted output here

1012

101289389

101289389

101289389

389

101289389

101289389

1012

101289389

take the number

to the left and

subtract

7

101289389

101289389

101289389

101289389

101289389

289389

89401289389

101289389

1289389 101289389

101289389

10128

01289389

101289389

10128

101289389

101289389

take the number

to the left and

subtract

101289389

89

101289389

101289389

1012

101289389

101

101289389

101289389

take the number

to the left

subtract

7

101289389

101289389

101289389

101289389 101289389

101289389

01289389

101289389

101289389

2012

101289389

101289389

take the number

to the left and

subtract.

7

101289389.

1012892

101289380

101289389

take the number

to the left and

subtract.

7

101289389

9389

10128

101289389

101289389

101289389

101289389

101289389

1012

1012893

101289389

01289389

89

101289389

1012893

10128938

1012893

1012893

1012893

101289389

101289389

01289389

101289389

1012893

101289389

101289389

1012893

101289389

1012893

101289389

10128

1012893

101289389

1012893

28958

1012893

101289389

1012893

1012893

101289389

1012893

1012893

101289389

101289389 1012893

10128

101289389

289389

101289389

49101289389

101289389

1012892

1012893

1012893

101289389

print to the terminal

"The final answer is"

followed by the value

currently in the pipeline

10128938 10128930

2012893

1012893

1012893

109389

101289389

1012893

101289389

1012893

101289389

128938

10122

1012893

101289389

101

0

1012893

1012893

1012893

1012893

012893

101289389

012893

1012893

1012893

1012893

1012893

101289389

1012893

Write the final value that will

pipeline here.

assigned

be in your

1012

101289389

389

101289389

101280

1012893

1012893

1012893

012893

1012893

1012893

101289389

1012893

0128938401-

101289389

2012893

Write the final value that will

be in your assigned pipeline here

372

101289389

12893

91012893

101289389

1012893

1012893

1012893

1012893

1012893

012893

101280

Write the final value that will

be in your assigned pipeline here

Fig: 1