Ch 6 - Data Types in Python; and Python Annotations: None is a separate data type from str, int, and so on. How can this feature help avoid the Billion Dollar mistake? Explain by referencing this sample code and what will (or won't) happen:
def foo(first: str, last: str):
print('Dr', first.upper())
print(last.lower())
b) Ch 7 Expressions and Assignment: I just tried writing and running the following Python code:
int(input("Type a number: "))
(x if else y)
print(x, y)
10
My hope was that if I typed 3, the output would have been 2, 10; while if I typed 7, the output would have been 10, 4. Instead, the interpreter crashed with the following message: (x if else y) 10
SyntaxError: cannot assign to conditional expression
Explain why this is an error using the appropriate term. (Hint: Think back to C++ vs. C# for the relevant terms:)