The mathematics teacher has given the problem to students to calculate the total cost of fencing along the field of length x metres and breadth y metres. Cost of 1 metre of fencing is rupees thousand take the value of x and y from the user. How will you do this task in Python
Answers
Answered by
0
Answer:
x=input("Enter the length in metres: ")
y=input("Enter the breadth in metres: ")
print("Total cost of fencing is: ₹",x*y*1000)
Answered by
0
Below are the program for the above question:
Explanation:
fencing_cost=2*(float(input("Enter the value of fencing length: "))+float(input("Enter the value of the fencing bradth: ")))#take the value from the user for lenth and bradth.
print("The cost value of the fencing is: "+str(fencing_cost*1000))#print the cost value.
Output:
- If the user gives the input as 2 for length and 1 for bradth then the cost is 6000.
- If the user gives the input as 1 for length and 2 for breadth then the cost is 6000.
Code Explantion :
- The above code is in python language, in which the first line is used to render a message for the input for length and breadth and then take the input and store the perimeter of the rectangle to the fencing_cost variable.
- Then the cost is printed by the print function after multiplying the perimeter with 1000.
Learn More:
- Python :brainly.in/question/14689905
Similar questions
Computer Science,
5 months ago
Math,
5 months ago
English,
9 months ago
Social Sciences,
9 months ago
Math,
1 year ago
Math,
1 year ago
History,
1 year ago