-1

How do I calculate the data type of False (notice the quotes around the word False!) and save it in a variable named q7, then print it out in python.

q7 = "False"
print(type(q7))

q7 = False != False
print(q7)

q7 = str (5 % 2 == 0)
print(q7)

q7 = "False"
print(q7)

q7 = "Is 5 even? " + str(5 % 2 == 0)
print(q7)

q7 = str('str')
print(type(q7))
Prune
  • 76,765
  • 14
  • 60
  • 81
Joseph
  • 1
  • 1
  • 2
    From `print(type(q7))`, it seems you already know how to get the type of something in Python. – costaparas Feb 14 '21 at 01:41
  • Does this answer your question? [How to check if type of a variable is string?](https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string) – Shunya Feb 14 '21 at 08:31

1 Answers1

0

You described exactly what you have to do:

# [Access]  the data type of False (notice the quotes ...)
# save it in a variable named q7
q7 = type("False")

# print it out
print(q7)

"Calculate" is the wrong term. You are merely looking up the data type, not "calculating" it.

Prune
  • 76,765
  • 14
  • 60
  • 81