Now Testius got it: it is Python strings that he needs to store his name as a Python variable! Write a statement to store Testius’s name a string in the variable Testius. Are there any other data types – besides string – that Testius can convert his name to?
1 2 3 4 | Output: Hi! I'm Testius now!! I'm True now!! boolean of empty string or 0 is False otherwise True |
Testius admires logic. It is all about yes/no – black or white. He wants his name to become a Boolean variable that says always true! How can he do that in Python? (hint: bool(string)).
1 2 | Output: True True True |
Testius is so excited about Python variables that he tries storing his phone number as a variable too! He types:
>>> my_phone = “098000111”
Sweet. He thinks he needs to encrypt that so people will not intervene and steal his information. He tries adding his mobile phone (mob_phone = “01001006”) to my_phone. However, the answer is not a sum. What did Testius do wrong? What does he need to do in order to convert and sum the numbers correctly?
1 2 3 4 | Output: My coded number is 09800011101001006 Oops! Hold on. My coded number is 99001117 |