1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tatiyna
3 years ago
12

MyProgramming Lab

Computers and Technology
1 answer:
AleksAgata [21]3 years ago
4 0

Answer:

The program in Python is as follows:

#1

d = int(input("distance: "))

n = int(input("n: "))

arith_prog = []

for i in range(1,n+1,d):

   arith_prog.append(i)

print(arith_prog)

#2

d = int(input("distance: "))

m = int(input("m: "))

n = int(input("n: "))

arith_prog = []

for i in range(m,n+1,d):

   arith_prog.append(i)

print(arith_prog)

#3

r = int(input("ratio: "))

n = int(input("n: "))

geom_prog = []

m = 1

count = 0

while(m<n):

   m = r**count

   geom_prog.append(m)

   count+=1

print(geom_prog)

Explanation:

#Program 1 begins here

This gets input for distance

d = int(input("distance: "))

This gets input for n

n = int(input("n: "))

This initializes the list, arith_prog

arith_prog = []

This iterates from 1 to n (inclusive) with an increment of d

for i in range(1,n+1,d):

This appends the elements of the progression to the list

   arith_prog.append(i)

This prints the list

print(arith_prog)

#Program 2 begins here

This gets input for distance

d = int(input("distance: "))

This gets input for m

m = int(input("m: "))

This gets input for n

n = int(input("n: "))

This initializes the list, arith_prog

arith_prog = []

This iterates from m to n (inclusive) with an increment of d

for i in range(m,n+1,d):

This appends the elements of the progression to the list

   arith_prog.append(i)

This prints the list

print(arith_prog)

#Program 3 begins here

This gets input for ratio

r = int(input("ratio: "))

This gets input for n

n = int(input("n: "))

This initializes the list, geom_prog

geom_prog = []

This initializes the element of the progression to 1

m = 1

Initialize count to 0

count = 0

This is repeated until the progression element is n

while(m<n):

Generate progression element

   m = r**count

Append element to list

   geom_prog.append(m)

Increase count by 1

   count+=1

This prints the list

print(geom_prog)

You might be interested in
Linguist study_____
-Dominant- [34]
That's B.

Linguist love all kinds of studies of languages culture writing etc.
6 0
3 years ago
How to copy and paste using keyboard onchromebook?
Diano4ka-milaya [45]
The copy combination is "ctrl+c". Highlight the text, go to where you want to paste it to, and use the combinations "ctrl+v".
5 0
3 years ago
Student aid is based on either financial need or _____ need.
anzhelika [568]

Answer:

academic

Explanation:

8 0
3 years ago
Read 2 more answers
What term refers to a written report given about an event or other newsworthy subject? A. press box B. press kit C. press pass D
guajiro [1.7K]
D. Press release is the correct answer. 
4 0
3 years ago
Read 2 more answers
Given f(x) = -2x2 + 5x - 1 and g(x) = 3x + 4 determine a simplified
lukranit [14]

Answer:

-6x^4 + 7x^3 + 17x^2 -4x

Explanation:

( f x g )( x )

Substitute

[( -2x^2 + 5x -1 )( 3x + 4 )]( x )

Use the Distributive Property

[-2x^2( 3x) + 5x( 3x) - 1( 3x) -2x^2( 4) + 5x (4) -1 (4)] (x)

Simplify

( -6x^3 + 7x^2 + 17x -4)(x)

Distributive Property

-6x^4 + 7x^3 + 17x^2 -4x

7 0
3 years ago
Other questions:
  • (Financial application: compound value) Suppose you save $100 each month into savings account with an annual interest rate of 5%
    6·1 answer
  • Which component is the smallest unit in a spreadsheet?
    14·2 answers
  • Which of the following is the best definition of a workplace policy?
    13·1 answer
  • Suppose that the host with IP address 10.0.1.19 sends an IP datagram destined to host 128.119.160.183. The source port is 3324,
    7·1 answer
  • Will give brainliest!<br> Who created binary, and does anyone have any idea how?
    13·1 answer
  • There are several design goals in building an operating system; for example, resource utilization, timeliness, robustness and so
    11·1 answer
  • Which of the following words best describes the word icon ​
    14·2 answers
  • What would the range(3, 9) function generate?
    5·1 answer
  • Find out about the different technological solutions available for interconnecting LANs to from larger networks such as wide are
    5·1 answer
  • The FCFS algorithm is particularly troublesome for ____________.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!