In: Computer Science
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.
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))