Explanation:
I have attached the answer as an image. I can't upload the file as it requires a licensed product and I only used demo version. I can provide the file too if you can give me your vlsig file required to use full software. However, If you just copy along the images on your Visual Studio, you will easily create the files yourself. Answer is provided for both scenarios as part A and part B, one which stops after 1 iteration and the one which loops until 0 height is given.
Firssstttttt ayyyyyyeeeeeeeeeeeee
The biggest thing she need to consider are her variables. and the output she will get.
Answer:
The solution code is written in Python:
- def square(num):
- if type(num).__name__ == 'int':
- sq_num = num * num
- return sq_num
- else:
- return "Invalid input"
-
- print(square(5))
- print(square("Test"))
Explanation:
To ensure only certain type of operation can be applied on a input value, we can check the data type of the input value. For example, we define a function and name it as <em>square</em> which take one input number, <em>num </em>(Line 1).
Before the <em>num</em> can be squared, it goes through a validation mechanism in by setting an if condition (Line 2) to check if the data type of the input number is an integer,<em> int.</em> If so, the<em> num </em>will only be squared otherwise it return an error message (Line 6).
We can test our function by passing value of 5 and "Test" string. We will get program output:
25
Invalid input