Case Study 1:
1. >>> item = 'A dozen eggs'
2. >>> itemPrice = 2.4
3. >>> print("{0} costs ${1:.2f}".format(item, itemPrice) )
4. ???
5. >>> myDict = {'name':'candy bar', 'price':95}
6. >>> print("The {name} costs {price} cents".format(**myDict) )
7. ???
-Refer to the session in the accompanying Case Study 1. What is printed on line 4?
A) A dozen eggs costs $2.4
B) A dozen eggs costs $2.40
C) {0} costs $2.4f
D) The {item} costs {itemPrice} cents
Correct Answer:
Verified
Q2: How is the newline character represented in
Q3: How would you use a for loop
Q4: What statement is used to close a
Q5: What string method is used to format
Q6: When using the format method with a
Q8: Case Study 1:
1. >>> item = 'A
Q9: The _ method returns the contents of
Q10: What Python module is used to get
Q11: Use the _ function to connect to
Q12: The data embedded in a file that
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents