Question

In: Computer Science

You need to determine the kind of class a particular variable is. How can you determine...

You need to determine the kind of class a particular variable is. How can you determine this? How can you determine its identifier?

Explain the operations performed and their order in evaluating the following expression, and give the result of that evaluation. -- var = -8.0 + 3.0 * 4.5 – 2.0 / 33.0

Write a statement that assigns the integer portion of a floating point variable named wraps to wholewraps as a floating point variable.

Show by a Python code example how to load the Python math library and then determine the square root of the variable gross.

Solutions

Expert Solution

Here is a code to do all these tasks:

The codes are well commented and easy to understand, if the answer helped you please upvote and if you have any doubts please comment i will surely help. please take care of the indentation while copying the code. Check from the screenshots provided.

Code:

# Determine the class of a variable
a = 10
print(type(a))

# Evaluating the variable
var = -8.0 + 3.0 * 4.5 - 2.0 / 33.0
print(var)

# Type casting, the integer part of the variable wraps(i.e. 10)
# to a float variable called wholewraps
wraps = 10.32
wholewraps = float(int(wraps))
print(wholewraps)

# find square root of the variable gross
import math
gross = 190
print(math.sqrt(gross))


Related Solutions

How can you determine if you need to use a combination or permutation to count the...
How can you determine if you need to use a combination or permutation to count the number of outcomes? Which will usually have more outcomes? Why? Provide an example in your explanation. (please provide detailed answer with no less than 100 characters)
b. What do we need to do in order to determine whether a categorical variable can...
b. What do we need to do in order to determine whether a categorical variable can be treated as a normally distributed variable?
b. What do we need to do in order to determine whether a categorical variable can...
b. What do we need to do in order to determine whether a categorical variable can be treated as a normally distributed variable?
I need a written contract that can be breached. It can be any kind of made...
I need a written contract that can be breached. It can be any kind of made up contract. Module 02 Course Project - The Contract: (This project is a compilation of skills required to understand Internet Law in its many facets. The students will demonstrate their knowledge of the Internet, laws associated with the internet, cases associated with the laws of the internet, possible remedies or sanctions given a break in the law and the ability to be self-reliant in...
What kind of asset is goodwill? How do you determine the amount of goodwill? How do...
What kind of asset is goodwill? How do you determine the amount of goodwill? How do you treat goodwill subsequent to its acquisition?
3) Suppose that you work for a firm that produces a particular kind of widget. In...
3) Suppose that you work for a firm that produces a particular kind of widget. In the past, assembly-line workers were compensated according to a piece rate scheme in which they were paid according to the number of pieces that moved through their station in a shift. Unfortunately, under this scheme, the costs of reworking poorly assembled pieces increased considerably. In a meeting, a colleague proposes changing to a scheme in which every worker on a line is paid according...
How would you define poverty? How would you determine whether a particular family is poor? Is...
How would you define poverty? How would you determine whether a particular family is poor? Is the test you have proposed an absolute or a relative test?
How can you tell if a particular security is debt or equity?
How can you tell if a particular security is debt or equity?
Given: You are given a Python Class template. In this class there is a class variable...
Given: You are given a Python Class template. In this class there is a class variable vector, is a list of N non-negative integers and are stored (in positions 0, 1, 2, ... (N-1)), where at least one integer is 0. Task: Write a recursive function "findAllPaths" to find all possible path through V starting at position 0, and ending at the location of 0, in accordance with the Rule below. If no such path exists, "paths" should be an...
6. Why do you need to declare the data type of a variable before you can...
6. Why do you need to declare the data type of a variable before you can use it in Java? Give two (2) reasons 7. Is the World Wide Web and the Internet just two names for the same entity? Explain. 8. Why was it necessary to use the import statement when we used Scanner and Random? 9. Communication was a problem at Target. What would you recommend as an escalation process if someone encounters a threat and wants it...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT