Question: Suppose I ask for two numbers from the user and divide them and then I ask for a number for up to how many decimal

 Suppose I ask for two numbers from the user and divide

Suppose I ask for two numbers from the user and divide them and then I ask for a number for up to how many decimal places they want to print the division. I want to do it by the formatting code method only. I know how to do it by the .format method but I cannot use it because you know the university will consider it cheating because it has not been taught in class. The one I tried in the image is wrong by the way.

Basically I want to replace the 5 in %.5f by any number that is entered by the user.

Thanks in advance.

w=int(input("Enter the number of decimal places: ")) x= int (input("Enter the value of x: ")) y=int(input("Enter the value of y:") ) z=x/y print(" %(xd)f(w,z)) Basically instead of the 5 in \%.5f I want the number input by the user only by this method.l

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!