Question

In: Computer Science

code in python write a code where the initial value is compounded by a multiplier, rounded...

code in python

write a code where the initial value is compounded by a multiplier, rounded to the nearest tenth

Output:

Initial Value: 10

Multiplier: 1.4

Number of compounds: 10

Your Values are: 10 , 14, 19.6 , 27.4, 38.4, 53.8, 75.3, 105.4, 147.6, 206.6

Solutions

Expert Solution

Answer-

CODE:

initial=int(input("Initial value : "))       #taking inputs
multiplier=float(input("Multiplier : "))
compound=int(input("No of compounds : "))
print("Your values are:")
mult=initial                         #initalizing to find answer
for i in range(0,compound):         #multiplying by multiplier
    print(round(mult,1))
    mult=mult*multiplier

OUTPUT

NOTE:-Please give a like if the answer helps.


Related Solutions

Code in python Write a while loop code where it always starts form 2. Then it...
Code in python Write a while loop code where it always starts form 2. Then it randomly chooses a number from 1-4. If the number 4 is hit then it will write “TP” if the number 1 is hit then it will write”SL”. It will rerun the program every time the numbers 1 and 5 are hit. The code should also output every single number that is randomly chosen. 2 of the same numbers can't be chosen back to back...
In Python Which initial value of x will make the following piece of code leave a...
In Python Which initial value of x will make the following piece of code leave a 9 in the final value of x? x = ____? if x < 7:    x = x + 1 x = x + 2 a. 11 b. 9 c. 7 d. None of the above Which initial value of x will make the following piece of code leave a 20 in the final value of x? x = ____? if x * 2...
Based on the following Python code, write a Python statement which outputs “December” when the value...
Based on the following Python code, write a Python statement which outputs “December” when the value of the Month is 12 or “November” when the value of the Month is 11 or “Neither” when value of the Month is neither 11 or 12. The user enters the value which is store in the variable namedMonth. Month = int(input("Please enter the value of the month in numerical format such as 11 for November, or 12 for December: " )) sing Python
Write in verilog, code to implement a 6 bit multiplier. Cascade a 1 bit multiplier to...
Write in verilog, code to implement a 6 bit multiplier. Cascade a 1 bit multiplier to implement this.
Write a VHDL code for a 8x8 bit multiplier. use structural approach. write the design code...
Write a VHDL code for a 8x8 bit multiplier. use structural approach. write the design code and testbench. Use for-generate if possible
2. Write python code for the below instructions (don’t forget to use the keyword “self” where...
2. Write python code for the below instructions (don’t forget to use the keyword “self” where appropriate in your code): A. Define a Parent Class called Person a. Inside your Person class, define new member variables called name, age, and gender.   Initialize these variables accordingly. b. Define the constructor to take the following inputs: name, age, and gender.   Assign these inputs to member variables of the same name. B. Define Child Class called Employee that inherits from the Person Class...
Write a small section of Python code that defines a function called check_even(value) - the function...
Write a small section of Python code that defines a function called check_even(value) - the function takes a numerical value as input and returns True or False based on whether the provided argument is divisible by 2 (i.e. is it odd or is it even). If the argument provided is not a number (as determined by built-in the isdigit() function - which only works on string data) then rather than crashing, the function should raise an exception which is caught...
Write a verilog code for 5 to 8 multiplier using fourbit adder
Write a verilog code for 5 to 8 multiplier using fourbit adder
Please write in beginner level PYTHON code! Your job is to write a Python program that...
Please write in beginner level PYTHON code! Your job is to write a Python program that asks the user to make one of two choices: destruct or construct. - If the user chooses to destruct, prompt them for an alternade, and then output the 2 words from that alternade. - If the user chooses construct, prompt them for 2 words, and then output the alternade that would have produced those words. - You must enforce that the users enter real...
please answer this in a simple python code 1. Write a Python program to construct the...
please answer this in a simple python code 1. Write a Python program to construct the following pattern (with alphabets in the reverse order). It will print the following if input is 5 that is, print z one time, y two times … v five times. The maximum value of n is 26. z yy xxx wwww vvvvvv
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT