In: Computer Science
Please attach the output screenshots, narrative descriptions, or paste the Python codes.
Please write code to print the type of the following variables. Please write down the codes and the output as well.
x = 3.5
y = '3.5'
z = {1:'John', 2:'Wick', 3:'Barry', 4:'Allen'}
hello,
there is a function in python names 'type()' which takes an argument and returns its type, the argument may be of any type .,
let us write code for your problem:-
your code starts from below:-
x = 3.5
y = '3.5'
z = {1:'John', 2:'Wick', 3:'Barry', 4:'Allen'}
print("type of x is ",type(x))
print("type of y is ",type(y))
print("type of z is ",type(z))
end of your code
i had simply used a function 'type()' and passed your variables 'x','y','z' as arguments in different statements
the output produced by the code will be:-
it clearly shows that the class type of x,y,and z are float,string, and Dictionary respectively.
i hope i had solved your problem to greater extent, feel free to ask your solution related queries in comment box. please consider my efforts and please upvote this solution.
thanku:)