Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7, Problem 2SA
a.
Program Plan Intro
Indexing:
- • In Python, the indexing is a method used for accessing individual data item in a given list.
- • Every data item in a given list has an index that can specify its location in the provided list.
- • In Python lists, normally, the indexing begins at “0”. Thus, the index of the first data item is “0”, the index of the second data item is “1”, and so on. The index of the last element is “-1”.
b.
Program Plan Intro
Indexing:
- • In Python, the indexing is a method used for accessing individual data item in a given list.
- • Every data item in a given list has an index that can specify its location in the provided list.
- • In Python lists, the indexing normally begins at “0”. Thus, the index of the first data item is “0”, the index of the second data item is “1”, and so on. The index of the last element is “-1”.
c.
Program Plan Intro
Indexing:
- • In Python, the indexing is a method used for accessing individual data item in a given list.
- • Every data item in a given list has an index that can specify its location in the provided list.
- • In Python lists, the indexing normally begins at “0”. Thus, the index of the first data item is “0”, the index of the second data item is “1”, and so on. The index of the last element is “-1”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
C programring
the code
CREATE FUNCTION Calculate_Monthly_Payment( @mortage_amount BIGINT , @apr DECIMAL(18, 6) , @years INT)RETURNS DECIMAL(18, 6)ASBEGIN
/* A = P (i + i (1+i) −1 n ) where: A = Monthly Payment Amount P = Principle (Initial) Mortgage Amount i = APR / 12 = Monthly Interest Rate n = years * 12 = Total Number of Payments */
-- Calculate monthly interest rate DECLARE @i DECIMAL(18, 6) SET @i = @apr / 12 DECLARE @n INTEGER SET @n = @years * 12
RETURN (@mortage_amount *@i * POWER(1+@i,@n)) / (POWER(1+@i, @n) - 1)
END
isn't working
it shows that
ERROR: syntax error at or near "@" LINE 3: @mortage_amount BIGINT ^ SQL state: 42601 Character: 48
What is the purpose of this code$Error=[] ;
Chapter 7 Solutions
Starting Out with Python (4th Edition)
Ch. 7.2 - What will the following code display? numbers =...Ch. 7.2 - Prob. 2CPCh. 7.2 - Prob. 3CPCh. 7.2 - Prob. 4CPCh. 7.2 - Prob. 5CPCh. 7.2 - Prob. 6CPCh. 7.2 - Prob. 7CPCh. 7.2 - Prob. 8CPCh. 7.3 - Prob. 9CPCh. 7.3 - Prob. 10CP
Ch. 7.3 - Prob. 11CPCh. 7.3 - Prob. 12CPCh. 7.3 - Prob. 13CPCh. 7.4 - What will the following code display? names =...Ch. 7.5 - Prob. 15CPCh. 7.5 - Prob. 16CPCh. 7.5 - Prob. 17CPCh. 7.5 - Prob. 18CPCh. 7.8 - Prob. 19CPCh. 7.8 - Prob. 20CPCh. 7.8 - Write a set of nested loops that display the...Ch. 7.9 - Prob. 22CPCh. 7.9 - Prob. 23CPCh. 7.9 - Prob. 24CPCh. 7.9 - Prob. 25CPCh. 7.10 - Prob. 26CPCh. 7.10 - Prob. 27CPCh. 7.10 - Prob. 28CPCh. 7.10 - Prob. 29CPCh. 7.10 - Prob. 30CPCh. 7.10 - To create a bar chart with the bar function, what...Ch. 7.10 - Assume the following statement calls the bar...Ch. 7.10 - Prob. 33CPCh. 7 - This term refers to an individual item in a list....Ch. 7 - This is a number that identifies an item in a...Ch. 7 - Prob. 3MCCh. 7 - This is the last index in a list. a. 1 b. 99 c. 0...Ch. 7 - This will happen if you try to use an index that...Ch. 7 - This function returns the length of a list. a....Ch. 7 - When the operator's left operand is a list and...Ch. 7 - This list method adds an item to the end of an...Ch. 7 - This removes an item at a specific index in a...Ch. 7 - Prob. 10MCCh. 7 - If you call the index method to locate an item in...Ch. 7 - Prob. 12MCCh. 7 - This file object method returns a list containing...Ch. 7 - Which of the following statement creates a tuple?...Ch. 7 - Prob. 1TFCh. 7 - Prob. 2TFCh. 7 - Prob. 3TFCh. 7 - Prob. 4TFCh. 7 - A file object's writelines method automatically...Ch. 7 - You can use the + operator to concatenate two...Ch. 7 - Prob. 7TFCh. 7 - You can remove an element from a tuple by calling...Ch. 7 - Prob. 1SACh. 7 - Prob. 2SACh. 7 - What will the following code display? values = [2,...Ch. 7 - Prob. 4SACh. 7 - Prob. 5SACh. 7 - Prob. 6SACh. 7 - Prob. 1AWCh. 7 - Prob. 2AWCh. 7 - Prob. 3AWCh. 7 - Prob. 4AWCh. 7 - Write a function that accepts a list as an...Ch. 7 - Prob. 6AWCh. 7 - Prob. 7AWCh. 7 - Prob. 8AWCh. 7 - Total Sales Design a program that asks the user to...Ch. 7 - Prob. 2PECh. 7 - Rainfall Statistics Design a program that lets the...Ch. 7 - Prob. 4PECh. 7 - Prob. 5PECh. 7 - Larger Than n In a program, write a function that...Ch. 7 - Drivers License Exam The local driver s license...Ch. 7 - Name Search If you have downloaded the source code...Ch. 7 - Prob. 9PECh. 7 - World Series Champions If you have downloaded the...Ch. 7 - Prob. 11PECh. 7 - Prob. 12PECh. 7 - Magic 8 Ball Write a program that simulates a...Ch. 7 - Expense Pie Chart Create a text file that contains...Ch. 7 - 1994 Weekly Gas Graph In the student sample...
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
- Code is here- def validate_name(passed_name): '''This function is used to validate the first and last name''' valid = False valid_chars = ['"', '\''] for character in passed_name: if character.isalpha() or character.isspace() and character in valid_chars: valid = True else: valid = False break return valid def validate_company(passed_model): '''This function is used to test the company name''' bad_chars = ['"'] if passed_model: for character in passed_model: if character in bad_chars: print("Company name is incorrect. Please try again. ") return False return True else: print("Please try again.") return False def validate_address(passed_model): '''This function is used to validate the vehicle model''' bad_chars = [ "!", '"', "@", "$", "%", "^", "$", "*", "_", "=", "+", "<", ">", "?", ";", "[", "]", "{", "}"] if passed_model: for character in passed_model: if character in bad_chars: print("Address is incorrect. Please try again.") return False return True else:…arrow_forward9. J= { a"b?n | n20 }arrow_forwardLanguage is Carrow_forward
- Program Name: <LastNameFirstInit>_PetShelter You work at a Pet Shelter that take in homeless pets. You have been tasked with creating a report that shows a list of all the dog breeds currently staying at the shelter. This list should include the breed name along with the count for each breedcurrently being housed at the shelter. In addition, at the end, the report should display the name of breed that we have the most (max) of currently at the shelter. In addition, your program should utilize methods for building the report and searching for the max breed count. Two parallel arrays have been provided. You can use the following code to get you started. //START CUTTING CODE HERE public class MichakR_PetShelter { public static void main(String[] args) { String[] breedNames = {"Bulldog", "German Shepherd", "Golden Retriever", "Beagle", "Poodle", "Boxer", "Mixed Dog", "Husky"}; int[] breedCounts = {2,5,3,1,8,1,11, 3}; //generate report //get Max Breed //print report } public…arrow_forwardYou can dereference a smart pointer with the * operator. True Falsearrow_forwardin c language typedef _people { int age; char name[ 32 ] ; } People_T ; People_T data [ 3 ]; Using string lib function, Assign 30 and Cathy to the first cell, Assign 40 and John to the second cell and Assign 50 and Tom to the third cellarrow_forward
- Please draw the correct flowchart for this game ? # Function to display question and answer def new_game(): guesses = [] Right_guesses = 0 question_num = 1 num = 1 for key in questions: print("\n------------------------- \n") print("Question " + str(num) + "\n" ) num += 1 print(key) for i in options[question_num-1]: print(i) guess = input("\nAnswer (A, B, C, or D): ") guess = guess.upper() guesses.append(guess) Right_guesses += check_answer(questions.get(key), guess) question_num += 1 display_score(Right_guesses, guesses) # ------------------------- # Function to check answer def check_answer(answer, guess): if answer == guess: print("\nYour Answer Correct!") return 1 else: print("\nYour Answer Wrong!") return 0 # ------------------------- # Function to display score def display_score(Right_guesses, guesses):…arrow_forwardplease only c code dont use c++ and c#. * Function: create_restaurant * Function: search_restaurants * Function: update_restaurants * Function: print_restaurant * Function: delete_restaurants write the functions according to the given parameters. #include <stdio.h>#include <stdlib.h>#include <string.h> #define N 2000#define D 250 // A simple restaurant structuretypedef struct{char restaurant_name[15];double rating;char city[31];unsigned short opening_year;} RESTAURANT_t, *RESTAURANT; // Arraylist structuretypedef struct ArrayList_s{void **list;int size;int capacity;int delta_capacity;} ArrayList_t, *ArrayList; /*** Function: create_restaurant* ---------------------------* This function creates a restaurant with the given parameters. Rating of the restaurant which is a rational number between 0 and 10.*/RESTAURANT create_restaurant(char *restaurant_name, double rating, char *city, unsigned short opening_year){// TODO: Fill this block. } * Function:…arrow_forward33 var number = 0; var number2 var number3 = 50; 34 12; 35 36 number = number + number2; number 37 number + number3 Challenge Problem: What will be stored in number at the end of the code?arrow_forward
- IN C PROGRAMMING!!! Follow the prompt in the picture and make sure output matches example.arrow_forwardPlease fo function to set grades .arrow_forwardin C++ Design an application that generates 10 random numbers in the range of 7 – 799. (Both the numbers included in the number set.). The application will print the 10 number set. Then the application picks a) the largest number and b) the smallest number occurring in the set.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education