Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 8, Problem 10AW
Look at the following statement:
mystring = 'cookies>milk>fudge>cake>ice cream'
Write a statement that splits this string, creating the following list:
['cookies', 'milk', 'fudge', 'cake', 'ice cream']
Expert Solution & Answer
Trending nowThis is a popular solution!
Learn your wayIncludes step-by-step video
schedule03:23
Students have asked these similar questions
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…
// EmployeeBonus2.cpp - This program calculates an employee's yearly bonus.
#include <iostream>
#include <string>
using namespace std;
int main()
{
// Declare and initialize variables.
string employeeFirstName;
string employeeLastName;
double employeeSalary;
int employeeRating;
double employeeBonus;
const double BONUS_1 = .25;
const double BONUS_2 = .15;
const double BONUS_3 = .10;
const double NO_BONUS = 0.00;
const int RATING_1 = 1;
const int RATING_2 = 2;
const int RATING_3 = 3;
// This is the work done in the housekeeping() function
// Get user input
cout << "Enter employee's first name: ";
cin >> employeeFirstName;
cout << "Enter employee's last name: ";
cin >> employeeLastName;
cout << "Enter employee's yearly salary: ";
cin >> employeeSalary;
cout << "Enter employee's performance rating: ";
cin >> employeeRating;
// This is…
#include <iostream>#include <string>
using namespace std;
int GetMonthAsInt(string month) { int monthInt = 0; if (month == "January") monthInt = 1; else if (month == "February") monthInt = 2; else if (month == "March") monthInt = 3; else if (month == "April") monthInt = 4; else if (month == "May") monthInt = 5; else if (month == "June") monthInt = 6; else if (month == "July") monthInt = 7; else if (month == "August") monthInt = 8; else if (month == "September") monthInt = 9; else if (month == "October") monthInt = 10; else if (month == "November") monthInt = 11; else if (month == "December") monthInt = 12; return monthInt;}
int main () { // TODO: Read dates from input, parse the dates to find the ones // in the correct format, and output in m-d-yyyy format
}
Chapter 8 Solutions
Starting Out with Python (4th Edition)
Ch. 8.1 - Assume the variable name references a string....Ch. 8.1 - What is the index of the first character in a...Ch. 8.1 - If a string has 10 characters, what is the index...Ch. 8.1 - Prob. 4CPCh. 8.1 - Prob. 5CPCh. 8.1 - Prob. 6CPCh. 8.2 - Prob. 7CPCh. 8.2 - Prob. 8CPCh. 8.2 - Prob. 9CPCh. 8.2 - What will the following code display? mystring =...
Ch. 8.3 - Prob. 11CPCh. 8.3 - Prob. 12CPCh. 8.3 - Write an if statement that displays Digit" if the...Ch. 8.3 - What is the output of the following code? ch = 'a'...Ch. 8.3 - Write a loop that asks the user Do you want to...Ch. 8.3 - Prob. 16CPCh. 8.3 - Write a loop that counts the number of uppercase...Ch. 8.3 - Assume the following statement appears in a...Ch. 8.3 - Assume the following statement appears in a...Ch. 8 - This is the first index in a string. a. 1 b. 1 c....Ch. 8 - This is the last index in a string. a. 1 b. 99 c....Ch. 8 - This will happen if you try to use an index that...Ch. 8 - This function returns the length of a string. a....Ch. 8 - This string method returns a copy of the string...Ch. 8 - This string method returns the lowest index in the...Ch. 8 - This operator determines whether one string is...Ch. 8 - This string method returns true if a string...Ch. 8 - This string method returns true if a string...Ch. 8 - This string method returns a copy of the string...Ch. 8 - Once a string is created, it cannot be changed.Ch. 8 - You can use the for loop to iterate over the...Ch. 8 - The isupper method converts a string to all...Ch. 8 - The repetition operator () works with strings as...Ch. 8 - Prob. 5TFCh. 8 - What does the following code display? mystr =...Ch. 8 - What does the following code display? mystr =...Ch. 8 - What will the following code display? mystring =...Ch. 8 - Prob. 4SACh. 8 - What does the following code display? name = 'joe'...Ch. 8 - Assume choice references a string. The following...Ch. 8 - Write a loop that counts the number of space...Ch. 8 - Write a loop that counts the number of digits that...Ch. 8 - Write a loop that counts the number of lowercase...Ch. 8 - Write a function that accepts a string as an...Ch. 8 - Prob. 6AWCh. 8 - Write a function that accepts a string as an...Ch. 8 - Assume mystrinc references a string. Write a...Ch. 8 - Assume mystring references a string. Write a...Ch. 8 - Look at the following statement: mystring =...Ch. 8 - Initials Write a program that gets a string...Ch. 8 - Sum of Digits in a String Write a program that...Ch. 8 - Date Printer Write a program that reads a string...Ch. 8 - Prob. 4PECh. 8 - Alphabetic Telephone Number Translator Many...Ch. 8 - Average Number of Words If you have downloaded the...Ch. 8 - If you have downloaded the source code you will...Ch. 8 - Sentence Capitalizer Write a program with a...Ch. 8 - Prob. 10PECh. 8 - Prob. 11PECh. 8 - Word Separator Write a program that accepts as...Ch. 8 - Pig Latin Write a program that accepts a sentence...Ch. 8 - PowerBall Lottery To play the PowerBall lottery,...Ch. 8 - Gas Prices In the student sample program files for...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Determine the minimum dimension a to the nearest mm of the beam's cross section to safely support the load. The...
Mechanics of Materials (10th Edition)
template class T T square(T number) { return T T; }
Starting Out with C++ from Control Structures to Objects (9th Edition)
?.1 Define the different reference meridians that can be used for the direction ofa line.
Elementary Surveying: An Introduction To Geomatics (15th Edition)
For the circuit shown, find (a) the voltage υ, (b) the power delivered to the circuit by the current source, an...
Electric Circuits. (11th Edition)
These static final variables are members of the numeric wrapper classes and hold the minimum and maximum values...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Describe a method that can be used to gather a piece of data such as the users age.
Web Development and Design Foundations with HTML5 (8th Edition)
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
- // EmployeeBonus.cpp - This program calculates an employee's yearly bonus. #include <iostream> #include <string> using namespace std; int main() { // Declare and initialize variables here string employeeFirstName; string employeeLastName; double numTransactions; double numShifts; double dollarValue; double score; double bonus; const double BONUS_1 = 50.00; const double BONUS_2 = 75.00; const double BONUS_3 = 100.00; const double BONUS_4 = 200.00; // This is the work done in the housekeeping() function cout << "Enter employee's first name: "; cin >> employeeFirstName; cout << "Enter employee's last name: "; cin >> employeeLastName; cout << "Enter number of shifts: "; cin >> numShifts; cout << "Enter number of transactions: "; cin >> numTransactions; cout << "Enter dollar value of transactions: "; cin >> dollarValue; // This is…arrow_forward// EmployeeBonus.cpp - This program calculates an employee's yearly bonus. #include <iostream> #include <string> using namespace std; int main() { // Declare and initialize variables here string employeeFirstName; string employeeLastName; double numTransactions; double numShifts; double dollarValue; double score; double bonus; const double BONUS_1 = 50.00; const double BONUS_2 = 75.00; const double BONUS_3 = 100.00; const double BONUS_4 = 200.00; // This is the work done in the housekeeping() function cout << "Enter employee's first name: Kim"; cin >> employeeFirstName; cout << "Enter employee's last name: Smith"; cin >> employeeLastName; cout << "Enter number of shifts: 25"; cin >> numShifts; cout << "Enter number of transactions: 75"; cin >> numTransactions; cout << "Enter dollar value of transactions: 40000.00"; cin >> dollarValue; // This is the work done in the detailLoop()function // Write your code here…arrow_forward#include <iostream> #include <iomanip> #include <string> using namespace std; int main() { constdouble MONSTERA_PRICE =11.50; constdouble PHILODENDRON_PRICE =13.75; constdouble HOYA_PRICE =10.99; constint MAX_POTS =20; constdouble POINTS_PER_DOLLAR =1.0/0.75; char plantType; int quantity; double totalAmount =0.0; int totalPoints =0; int availablePots =0; double plantPrice =0.0; cout << "Welcome to Tom's Plant Shop!" << endl; cout << "******************************" << endl; cout << "Enter your full name: "; string fullName; getline(cin, fullName); output: compiling code... Welcome to Tom's Plant Shop!----------------------------------------Enter your full name: ______ Available plants:M - Monstera ($ 11.5)P - Philodendron ($13.75)H - Hoya ($10.99)Q - Quit shoppingEnter the plant type (M/P/H/Q): ________ Part 1 Tom has recently started a plant-selling business, and he offers three different types of plants, namely Monstera,…arrow_forward
- // Airline.cpp - This program determines if an airline passenger is // eligible for a 25% discount. #include <iostream> #include <string> using namespace std; int main() { string passengerFirstName = ""; // Passenger's first name string passengerLastName = ""; // Passenger's last name int passengerAge = 0; // Passenger's age // This is the work done in the housekeeping() function cout << "Enter passenger's first name: "; cin >> passengerFirstName; cout << "Enter passenger's last name: "; cin >> passengerLastName; cout << "Enter passenger's age: "; cin >> passengerAge; // This is the work done in the detailLoop() function // Test to see if this customer is eligible for a 25% discount // This is the work done in the endOfJob() function return 0; }arrow_forward// Airline.cpp - This program determines if an airline passenger is // eligible for a 25% discount. #include <iostream> #include <string> using namespace std; int main() { string passengerFirstName = ""; // Passenger's first name string passengerLastName = ""; // Passenger's last name int passengerAge = 0; // Passenger's age // This is the work done in the housekeeping() function cout << "Enter passenger's first name: "; cin >> passengerFirstName; cout << "Enter passenger's last name: "; cin >> passengerLastName; cout << "Enter passenger's age: "; cin >> passengerAge; // This is the work done in the detailLoop() function // Test to see if this customer is eligible for a 25% discount // This is the work done in the endOfJob() function return 0; }arrow_forward// Airline.cpp - This program determines if an airline passenger is // eligible for a 25% discount. // Harvey Mark, ITSE 1329#include <iostream> #include <string> using namespace std; int main() { string passengerFirstName = ""; // Passenger's first name string passengerLastName = ""; // Passenger's last name int passengerAge = 0; // Passenger's age // This is the work done in the housekeeping() function cout << "Enter passenger's first name: "; cin >> passengerFirstName; cout << "Enter passenger's last name: "; cin >> passengerLastName; cout << "Enter passenger's age: "; cin >> passengerAge; // This is the work done in the detailLoop() function // Test to see if this customer is eligible for a 25% discount if(passengerAge <= 6) { cout << "You are eligable for a discount!\n"; } if(passengerAge >= 65) { cout << "You are eligable for a…arrow_forward
- // LeftOrRight.cpp - This program calculates the total number of left-handed and right-handed // students in a class. // Input: L for left-handed; R for right handed; X to quit. // Output: Prints the number of left-handed students and the number of right-handed students. #include <iostream> #include <string> using namespace std; int main() { string leftOrRight = ""; // L or R for one student. int rightTotal = 0; // Number of right-handed students. int leftTotal = 0; // Number of left-handed students. // This is the work done in the housekeeping() function cout << "Enter an L if you are left-handed, a R if you are right-handed or X to quit: "; cin >> leftOrRight; // This is the work done in the detailLoop() function // Write your loop here. // This is the work done in the endOfJob() function // Output number of left or right-handed students. cout << "Number of left-handed students:…arrow_forward// LeftOrRight.cpp - This program calculates the total number of left-handed and right-handed // students in a class. // Input: L for left-handed; R for right handed; X to quit. // Output: Prints the number of left-handed students and the number of right-handed students. #include <iostream> #include <string> using namespace std; int main() { string leftOrRight = ""; // L or R for one student. int rightTotal = 0; // Number of right-handed students. int leftTotal = 0; // Number of left-handed students. // This is the work done in the housekeeping() function cout << "Enter an L if you are left-handed, a R if you are right-handed or X to quit: "; cin >> leftOrRight; // This is the work done in the detailLoop() function // Write your loop here. // This is the work done in the endOfJob() function // Output number of left or right-handed students. cout << "Number of left-handed students:…arrow_forward$majors['CS'] = 'Computer Science'; //Line 1 Smajors['MTH'] = 'Mathematics'; //Line 2 echo "The two majors are $majors['CS'] and $majors['MTH']"; //Line 3 ?> A mistake is found in (Put the line # of the statement as your answer) The corrected statement isarrow_forward
- [ITEM#3] Instructions: Kindly provided what is being asked in the photo below. Must answer correctly and completely. Any incorrect/incomplete solution will not be liked.arrow_forward//main.cpp #include "Person.h"#include "Seller.h"#include "Powerseller.h"#include <iostream>#include <list>#include <fstream>#include <string> using namespace std; void printMenu();void printSellers(list<Seller*> sellers);void checkSeller(list<Seller*> sellers);void addSeller(list<Seller*> sellers);void deleteSeller(list<Seller*> &sellers); int main() { list<Seller*> sellers; ifstream infile; infile.open("sellers.dat"); if (!infile) { cerr << "File could not be opened." << endl; exit(1); } char type; while (!infile.eof()) { infile >> type; if (type == 'S') { Seller* newseller = new Seller; newseller -> read(infile); sellers.push_back(newseller); } if (type == 'P') { Powerseller* newpowerseller = new Powerseller; newpowerseller -> read(infile); sellers.push_back(newpowerseller); } } infile.close();…arrow_forwardLook at the following code.double value = 29.7;double *ptr = &value;Write a cout statement that uses the ptr variable to display the contents of the valuevariable.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
Program to find HCF & LCM of two numbers in C | #6 Coding Bytes; Author: FACE Prep;https://www.youtube.com/watch?v=mZA3cdalYN4;License: Standard YouTube License, CC-BY