Another way of testing using 'if'
There is a neat way of testing if a string, list or tuple has something in it or is empty, or whether a number is zero. Copy the following code into Python:
#strings, lists and tuples
return '\nThe string has something in it so do this block.\n'
return '\nThe string is empty so do this block.\n'
string1 = ''
string2 = 'Hello'
return "\nThe list has at least one element in it so 'if try_this' is True.\n"
return "\nThe list is empty so 'if try_this' is False.\n"
list1 = 
list2 = ['Jack', 'Mary', 'Dave']
Look at the rather curious line in the two functions if try_this: This is still a Boolean test, even if it doesn't look like one! The variable try_this is examined. If it has something in it, anything at all, then True is returned. If it is empty, then False is returned.
Q1. Test to see if this will work for a tuple.
Q2. Modify the second function so that it simply returns the Boolean value True if there is something in the list and the Boolean value False if it is empty.
Q3. Enter this code into Python:
return "\nThe number is not zero so this is True.\n"
return "\nThe number is zero so this is False.\n"
num1 = 5
num2 = 0
What do you think will happen? Try it and see if you were correct. Predict what will happen with different values e.g. -6, -50.34, 0.0, 105.65, 'R', 'True', 'False'.