Starting Out with Python (3rd Edition)
3rd Edition
ISBN: 9780133582734
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 9.1, Problem 5CP
What will the following code display?
stuff = {1 : 'aaa', 2 : 'bbb', 3 : 'ccc'}
print(stuff[3])
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Assume int[] t = {0, 1, 2, 3, 4, 5}; What is t[6]?
undefined, there is an error in this code
4
6
5
What is the purpose of this code$Error=[] ;
int grades[100];
int i;
for (i=0;i <= 100;i++)
{
grades[i) = 100;
}
The above C++ code is the proper way to initialize the grades array, TRUE or FLASE
True
False
Chapter 9 Solutions
Starting Out with Python (3rd Edition)
Ch. 9.1 - An element in a dictionary has two parts. What are...Ch. 9.1 - Which part of a dictionary element must be...Ch. 9.1 - Suppose ' start' : 1472 is an element in a...Ch. 9.1 - Suppose a dictionary named employee has been...Ch. 9.1 - What will the following code display? stuff = {1 :...Ch. 9.1 - Prob. 6CPCh. 9.1 - Suppose a dictionary named inventory exists. What...Ch. 9.1 - What will the following code display? stuff = {1 :...Ch. 9.1 - What will the following code display? stuff = {1 :...Ch. 9.1 - What is the difference between the dictionary...
Ch. 9.1 - Prob. 11CPCh. 9.1 - Prob. 12CPCh. 9.1 - What does the values method return?Ch. 9.2 - Prob. 14CPCh. 9.2 - Prob. 15CPCh. 9.2 - Prob. 16CPCh. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - Prob. 22CPCh. 9.2 - After the following statement executes, what...Ch. 9.2 - After the following statement executes, what...Ch. 9.2 - Prob. 25CPCh. 9.2 - Prob. 26CPCh. 9.2 - After the following code executes, what elements...Ch. 9.2 - Prob. 28CPCh. 9.2 - After the following code executes, what elements...Ch. 9.2 - After the following code executes, what elements...Ch. 9.2 - After the following code executes, what elements...Ch. 9.2 - Prob. 32CPCh. 9.3 - Prob. 33CPCh. 9.3 - When you open a file for the purpose of saving a...Ch. 9.3 - When you open a file for the purpose of retrieving...Ch. 9.3 - Prob. 36CPCh. 9.3 - Prob. 37CPCh. 9.3 - Prob. 38CPCh. 9 - You can use the __________ operator to determine...Ch. 9 - You use ________ to delete an element from a...Ch. 9 - The ________ function returns the number of...Ch. 9 - You can use_________ to create an empty...Ch. 9 - The _______ method returns a randomly selected...Ch. 9 - The __________ method returns the value associated...Ch. 9 - The __________ dictionary method returns the value...Ch. 9 - The ________ method returns all of a dictionary's...Ch. 9 - The following function returns the number of...Ch. 9 - Prob. 10MCCh. 9 - Prob. 11MCCh. 9 - This set method removes an element, but does not...Ch. 9 - Prob. 13MCCh. 9 - Prob. 14MCCh. 9 - This operator can be used to find the difference...Ch. 9 - Prob. 16MCCh. 9 - Prob. 17MCCh. 9 - The keys in a dictionary must be mutable objects.Ch. 9 - Dictionaries are not sequences.Ch. 9 - Prob. 3TFCh. 9 - Prob. 4TFCh. 9 - The dictionary method popitem does not raise an...Ch. 9 - The following statement creates an empty...Ch. 9 - Prob. 7TFCh. 9 - Prob. 8TFCh. 9 - Prob. 9TFCh. 9 - Prob. 10TFCh. 9 - What will the following code display? dct =...Ch. 9 - What will the following code display? dct =...Ch. 9 - What will the following code display? dct =...Ch. 9 - What will the following code display? stuff =...Ch. 9 - How do you delete an element from a dictionary?Ch. 9 - How do you determine the number of elements that...Ch. 9 - Prob. 7SACh. 9 - What values will the following code display? (Dont...Ch. 9 - After the following statement executes, what...Ch. 9 - After the following statement executes, what...Ch. 9 - After the following statement executes, what...Ch. 9 - After the following statement executes, what...Ch. 9 - After the following statement executes, what...Ch. 9 - What will the following code display? myset =...Ch. 9 - After the following code executes, what elements...Ch. 9 - Prob. 16SACh. 9 - Prob. 17SACh. 9 - Prob. 18SACh. 9 - After the following code executes, what elements...Ch. 9 - Prob. 20SACh. 9 - Write a statement that creates a dictionary...Ch. 9 - Write a statement that creates an empty...Ch. 9 - Assume the variable dct references a dictionary....Ch. 9 - Assume the variable dct references a dictionary....Ch. 9 - Prob. 5AWCh. 9 - Prob. 6AWCh. 9 - Prob. 7AWCh. 9 - Prob. 8AWCh. 9 - Prob. 9AWCh. 9 - Prob. 10AWCh. 9 - Assume the variable dct references a dictionary....Ch. 9 - Write code that retrieves and unpickles the...Ch. 9 - Course information Write a program that creates a...Ch. 9 - Capital Quiz The Capital Quiz Problem Write a...Ch. 9 - File Encryption and Decryption Write a program...Ch. 9 - Unique Words Write a program that opens a...Ch. 9 - Prob. 5PECh. 9 - File Analysis Write a program that reads the...Ch. 9 - World Series Winners In this chapters source code...Ch. 9 - Name and Email Addresses Write a program that...Ch. 9 - Blackjack Simulation Previously in this chapter...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- * A = [2-31; 20 -1; 1 4 5], then det(A) is 49 39 27 33 Other:arrow_forwardint a[ 10] = {1,5,3,8,4,2,6,9,7}; int *p; p = &a[2]; p[0] = 10; p[1] = 15; What are the values of a? Select one: O a. {10,15,3,8,4,2,6,9,7} O b. {1,15,10,8,4,2,6,9,7} O c. {1,5,10,15,4,2,6,9,7} O d. {1,10,15,8,4,2,6,9,7}arrow_forwardAssign pizzasInStore's first element's numCalories with the value in pizzasInStore's second element's numCalories. #include <stdio.h>#include <string.h> typedef struct Pizza_struct { char pizzaName[75]; int numCalories;} Pizza; int main(void) { Pizza pizzasInStore[2]; scanf("%s", pizzasInStore[0].pizzaName); scanf("%d", &pizzasInStore[0].numCalories); scanf("%s", pizzasInStore[1].pizzaName); scanf("%d", &pizzasInStore[1].numCalories); /* Your code goes here */ printf("A %s slice contains %d calories.\n", pizzasInStore[0].pizzaName, pizzasInStore[0].numCalories); printf("A %s slice contains %d calories.\n", pizzasInStore[1].pizzaName, pizzasInStore[1].numCalories); return 0;} I tried 10 time but I cant solve it so please help mearrow_forward
- #include <stdio.h>#include <string.h>#define SIZE 6struct Cake {char name[50];float price;};int searchChoice(char *choice, struct Cake data[]);void displayChoice(int index, struct Cake data[]);int main() {char choice[50];int index;//Answer for Part (i) – Declare and initialise array stockprintf("What is your choice of cake? ");gets(choice);index = searchChoice(choice, stock);displayChoice(index, stock);return 0;}//Answer for Part (ii) – Function definition for searchChoice//Answer for Part (iii) – Function definition for displayChoicearrow_forwardC programming language questionarrow_forwardWhat the following code does? int * foo = new int [5]; if (!foo) { ..}arrow_forward
- Homework - identical arrays for one-dimensional: Write a test program which prompts a user to enter the size of two arrays as well as to fill their elements. After that, the program checks the same contents of the elements of the two arrays. If these arrays are equal, the program displays message which is "The two arrays are identical". If not equal, displaying "The two arrays are not identical". Write an equals method that reads two arrays and displays these messages above.arrow_forward#include <iostream>#include<iomanip>using namespace std; int main(){ const int ROW_HOURS=6; //declare variables const int CL_PAYRATE=2; double total_payout=0; double hours[ROW_HOURS][CL_PAYRATE]={ //declare array {0,12.85}, {0,12.85}, {0,12.85}, {0,11.75}, {0,11.75}, {0,11.15} }; cout<<fixed; cout<<setprecision(2); //setprecision of double values upto 2 decimal point for(int i=0;i<6;i++) //using loop get input from user { cout<<"Enter the hours worked by employee "<<i+1<<": "; cin>>hours[i][0]; //store values into hours } for(int i=0;i<6;i++) { double payout=hours[i][0]*hours[i][1]; //calculate payout of emplyee total_payout=total_payout+payout;…arrow_forwardUsage: mortgagepmt [-s] -r rate [-d downpayment] price In this assignment, you are asked to do a mortgage payment calculation. All information needed for this will be passed to the program on the command line. There will be no user input during the execution of the program. You will need a few pieces of information. The price of the home and the amount of the down payment. You will also need to know the interest rate and the term of the mortgage. To figure your mortgage payment, start by converting your annual interest rate to a monthly interest rate by dividing by 12. Next, add 1 to the monthly rate. Third, multiply the number of years in the term of the mortgage by 12 to calculate the number of monthly payments you’ll make. Fourth, raise the result of 1 plus the monthly rate to the negative power of the number of monthly payments you’ll make. Fifth, subtract that result from 1. Sixth, divide the monthly rate by the result. Last, multiply the result by the amount you want to borrow.…arrow_forward
- #include <iostream> #include <ctime> #include <cmath> const int MAX = 1000; const char CLASS[] = {'A','B','C'}; struct Points{ int x,y; char c; double dist(Points q){ return sqrt(pow(x-q.x,2)+pow(y-q.y,2)); } }; int main(){ return 0; } int main(){ srand(time(0)); }arrow_forward#include <stdio.h>#include <stdlib.h> typedef struct Number_struct { int num;} Number; void Swap(Number* numPtr1, Number* numPtr2) { /* Your code goes here */} int main(void) { Number* num1 = NULL; Number* num2 = NULL; num1 = (Number*)malloc(sizeof(Number)); num2 = (Number*)malloc(sizeof(Number)); int int1; int int2; scanf("%d", &int1); scanf("%d", &int2); Thank you so much but i forgot to put this how i would fit in into this. num1->num = int1; num2->num = int2; Swap(num1, num2); printf("num1 = %d, num2 = %d\n", num1->num, num2->num); return 0;}arrow_forwardchar[] b = {'a', 'b', 'c', '5'}; System.out.println(b.charAt(2)); displays an error occurs because b is not a variable of type String the character c the character barrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Dictionaries - Introduction to Data Structures (Episode 8); Author: NullPointer Exception;https://www.youtube.com/watch?v=j0cPnbtp1_w;License: Standard YouTube License, CC-BY