What calc() function?, and give the example please! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What calc() function?, and give the example please!

19th Sep 2023, 12:22 PM
Ketsu dayou
Ketsu dayou - avatar
7 Answers
+ 5
You are supposed to complete the calc() function. This is the task.
19th Sep 2023, 1:30 PM
Lisa
Lisa - avatar
+ 3
Mention course name and task title.
19th Sep 2023, 1:10 PM
Lisa
Lisa - avatar
+ 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
19th Sep 2023, 1:43 PM
Mafdi
Mafdi - avatar
+ 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.
19th Sep 2023, 1:16 PM
Ketsu dayou
Ketsu dayou - avatar
19th Sep 2023, 1:20 PM
Ketsu dayou
Ketsu dayou - avatar
+ 1
From the previous comment, it is clear that the OP refers to a Python task.
20th Sep 2023, 1:56 PM
Lisa
Lisa - avatar
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
20th Sep 2023, 1:51 PM
Dagne Negeri Deso
Dagne Negeri Deso - avatar