<jupyter_start><jupyter_text>Practice Questions1. Which of the following are operators, and which are values?<jupyter_code>*
'hello'
-88.8
-
/
+
5
print("* is an operator")
print("'hello' is a value")
print((str(-88.8)) + (" is a value"))
print("- is an operator")
print("/ is an operator")
print("+ is an operator")
print((str(5)) + (" is a value"))<jupyter_output>* is an operator
'hello' is a value
-88.8 is a value
- is an operator
/ is an operator
+ is an operator
5 is a value<jupyter_text>2. Which of the following is a variable, and which is a string?<jupyter_code>spam
'spam'
spam = "spam is a variable"
print(spam)
print("'spam' is a string")<jupyter_output>spam is a variable
'spam' is a string<jupyter_text>3. Name three data types.4. What is an expression made up of? What do all expressions do?5. This chapter introduced assignment statements, like spam = 10. What is the difference between an expression and a statement?6. What does the variable eggs contain after the following code runs? 1. 3 datatypes are: string, integer, and float2. An expression is the simplest instruction in Python, made up of values and operators.3. An expression is an instruction for Python with values and operators, while a statement is an instruction that stores a variable.4. The following variable "eggs" runs the integer 21<jupyter_code>eggs = 20
eggs + 1<jupyter_output><empty_output><jupyter_text>7. What should the following two expressions evaluate to? 1. 2*3 spam, or 6 spam. Lots of spam. spamspamspamspamspamspam. Too much spam, in fact.<jupyter_code>'spam' + 'spamspam'
'spam' * 3
print('spam' + 'spamspam')
print(('spam') * 3)<jupyter_output>spamspamspam
spamspamspam<jupyter_text>8. Why is eggs a valid variable name while 100 is invalid?9. What three functions can be used to get the integer, floating-pointnumber, or string version of a value?10. Why does this expression cause an error? How can you fix it? 1. A variable must begin as a string (with alphabetical characters)2. int(), float(), and str()3. (In [33])<jupyter_code>'I have eaten ' + 99 + ' burritos.'
print(('I have eaten ') + (str(99)) + (' burritos.'))
print("well done")<jupyter_output>I have eaten 99 burritos.
well done
{'fraction_non_alphanumeric': 0.10727272727272727, 'fraction_numerical': 0.025, 'mean_word_length': 4.964769647696477, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '479629', 'license': 'MIT', 'n_tokens_mistral': 748, 'n_tokens_neox': 710, 'n_words': 301, 'path': 'Answers to Chapter 1 Practice Questions.ipynb', 'repo_name': 'Filipowich/jupyterNotebook-EECS1530-AF', 'size': '2200'}