0
What calc() function?, and give the example please!
7 Antworten
+ 5
You are supposed to complete the calc() function. This is the task.
+ 3
Mention course name and task title.
+ 3
Your task is to create the calc function which takes one argument (an integer), and it outputs a tuple of two integers
Steps:
- calculate perimeter
- calculate area
- output a tuple that has perimeter and area
+ 1
Tuple Unpacking
Tuples can be used to output multiple values from a function. You need to make a function called calc(), that will take the side length of a square as its argument and return the perimeter and area using a tuple.
The perimeter is the sum of all sides, while the area is the square of the side length.
Sample Input 3
Sample Output
Perimeter: 12
Area: 9
The given code takes a number from user input, passes it to the calc() function, and uses unpacking to get the returned values.
+ 1
From the previous comment, it is clear that the OP refers to a Python task.
0
A powerful CSS method that lets you calculate numerical values to determine a CSS property's value is called calc(). Using various units, variables, or mathematical expressions, it can be used to dynamically calculate values.
For exaple
.container {
width: calc(100% - 20px);
height: calc(50vh + 10px);
font-size: calc(14px * 1.2);
}
Is it clear....? Say something