Starting Out with Python plus MyProgrammingLab with Pearson eText -- Access Card Package (3rd Edition)
3rd Edition
ISBN: 9780133862256
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 6MC
A ______ is a sequence of characters.
a. char sequence
b. character collection
c. string
d. text block
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Please explain this code:
#include <iostream>#include <cstring>using namespace std;
int main(){ char userInput[50]; cout << "Enter a word in lowercase letters: "; cin >> userInput; for (int i = 0; i <= strlen(userInput); i++) { userInput[i] = toupper(userInput[i]); } cout << userInput; return 0;}
What will the following Code segment print on the screen?
String LName = "FamilyName"; String FName = "GivenName"; System.out.println("Dear Mr " + LName); System.out.println("We would like to call you " + FName);
CREAT A FLOWCHART WITH THIS CODE#include <iostream>#include<cmath> using namespace std;
int main(){ int a,b,c,l;
cout <<"Enter the three sides of the triangle\n"; cout<<"Side A: "; cin>>a; cout<<"Side B: "; cin>>b; cout<<"Side A: "; cin>>c; cout<<"Length of the triangle prism: "; cin>>l;
float s=(float)(a+b+c)/2; //calculating s
float area=sqrt(s*(s-a)*(s-b)*(s-c)); //calculating area float volume = area*l; float cost = area*1010.85; cout<<"The Area of the triangle is "<<area<<endl; cout<<"The Volume of the triangle prism is "<<volume<<endl; cout<<"The cost of the carpet per square meter is "<<cost<<" meter"<<endl; return 0;
}
Chapter 2 Solutions
Starting Out with Python plus MyProgrammingLab with Pearson eText -- Access Card Package (3rd Edition)
Ch. 2.1 - Who is a programmers customer?Ch. 2.1 - What is a software requirement?Ch. 2.1 - What is an algorithm?Ch. 2.1 - What is pseudocode?Ch. 2.1 - Prob. 5CPCh. 2.1 - Prob. 6CPCh. 2.3 - Write a statement that displays your name.Ch. 2.3 - Write a statement that displays the following...Ch. 2.3 - Write a statement that displays the following...Ch. 2.5 - Prob. 10CP
Ch. 2.5 - Which of the following are illegal variable names...Ch. 2.5 - Prob. 12CPCh. 2.5 - Is the following assignment statement valid or...Ch. 2.5 - Prob. 14CPCh. 2.5 - Look at the following assignment statements:...Ch. 2.5 - What will be displayed by the following program?...Ch. 2.6 - You need the user of a program to enter a...Ch. 2.6 - Prob. 18CPCh. 2.7 - Prob. 19CPCh. 2.7 - Prob. 20CPCh. 2.7 - Prob. 21CPCh. 2 - A ______ error does not prevent the program from...Ch. 2 - Prob. 2MCCh. 2 - A(n) __________ is a set of well-defined logical...Ch. 2 - An Informal language that has no syntax rules and...Ch. 2 - A _______ is a diagram that graphically depicts...Ch. 2 - A ______ is a sequence of characters. a. char...Ch. 2 - Prob. 7MCCh. 2 - Prob. 8MCCh. 2 - A string literal in Python must be enclosed in...Ch. 2 - Prob. 10MCCh. 2 - A(n) __________ makes a variable reference a value...Ch. 2 - This symbol marks the beginning of a comment in...Ch. 2 - Which of the following statements will cause an...Ch. 2 - In the expression 12 + 7, the values on the right...Ch. 2 - This operator performs integer division. a. // b....Ch. 2 - This is an operator that raises a number to a...Ch. 2 - This operator performs division, but instead of...Ch. 2 - Prob. 18MCCh. 2 - Which built-in function can be used to read input...Ch. 2 - Prob. 20MCCh. 2 - Programmers must be careful not to make syntax...Ch. 2 - In a math expression, multiplication and division...Ch. 2 - Variable names can have spaces in them.Ch. 2 - In Python, the first character of a variable name...Ch. 2 - If you print a variable that has not been assigned...Ch. 2 - What does a professional programmer usually do...Ch. 2 - What is pseudocode?Ch. 2 - Computer programs typically perform what three...Ch. 2 - If a math expression adds a float to an int, what...Ch. 2 - What is the difference between floating-point...Ch. 2 - Write Python code that prompts the user to enter...Ch. 2 - Write Python code that prompts the user to enter...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Assume the variables result, w, x, y, and z are...Ch. 2 - Write a Python statement that assigns the sum of...Ch. 2 - Write a Python statement that subtracts the...Ch. 2 - Write a Python statement that multiplies the...Ch. 2 - Prob. 8AWCh. 2 - What would the following display? num = 99 num = 5...Ch. 2 - Assume the variable sales references a float...Ch. 2 - Assume the following statement has been executed:...Ch. 2 - What will the following statement display?...Ch. 2 - Personal Information Write a program that displays...Ch. 2 - Sales Prediction A company has determined that its...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Total Purchase A customer in a store is purchasing...Ch. 2 - Distance Traveled Assuming there are no accidents...Ch. 2 - Sales Tax Write a program that will ask the user...Ch. 2 - Miles-per-Gallon A car's miles-per-gallon (MPG)...Ch. 2 - Tip, Tax, and Total Write a program that...Ch. 2 - Celsius to Fahrenheit Temperature Converter Write...Ch. 2 - Ingredient Adjuster A cookie recipe calls for the...Ch. 2 - Male and Female Percentages Write a program that...Ch. 2 - Stock Transaction Program Last month, Joe...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
A byte is made up of eight a. CPUs b. addresses c. variables d. bits
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Introduced in 1983, this application program became the “killer app” that made the IBM PC a must-have business ...
SURVEY OF OPERATING SYSTEMS
Why is the study of database technology important?
Database Concepts (7th Edition)
Categorize each of the following items as either hardware or software: CPU C++ compiler ALU C++ preprocessor in...
C How to Program (8th Edition)
When a selector name starts with a period in a JavaFX CSS style definition, it means the selector corresponds t...
Starting Out with Java: Early Objects (6th Edition)
Computers process data under the control of sets of instructions called
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
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
- Write a code snippet that can arrange the alphabets of a name entered by user in alternate cases.Note: Ignore white spaces. Input String:Timothy Olyphant Output String :TiMoThY OLyPhAnT Input String: Olga Kurylenko Output string: OlGa KuRyLeNkOarrow_forwardWrite a code snippet that can arrange the alphabets of a name entered by user in alternate cases. Note: Ignore white spaces. Input String : Timothy Olyphant Output String : TiMoThY oLyPhAnT Input String : Olga Kurylenko Output String : OlGa KuRyLeNkOarrow_forward// ChangeCase.cpp - This program converts characters to lowercase and uppercase.// Input: Interactive// Output: Uppercase and lowercase versions of the user-entered string#include <iostream>#include <string>using namespace std;int main() { const int LEN = 9; char sample1[LEN]; char sample2[LEN]; char result1; char result2; int i; cout << "Enter 9 lowercase characters: "; for(i = 0; i < LEN; i++) { cin >> sample1[i]; // Convert sample1[i] to uppercase and assign it to result1 cout << result1 << endl; } cin.ignore(256,'\n'); cout << "Enter 9 uppercase characters: "; for(i = 0; i < LEN; i++) { cin >> sample2[i]; // Convert sample2[i] to lowercase and assign it to result2 cout << result2 << endl; } cin.ignore(256,'\n'); return 0;} // End of main() functionarrow_forward
- Create aC++ function named countWords that counts the number of words in the current string and displays a message stating how many words are in the string Examples: The string 2015 has zero words The string "Hello World" has two words The string " I am Woman " has 3 wordsarrow_forwardZybook Lab highway_number = int(input())if(highway_number>=1 and highway_number<=99): if(highway_number%2==0): print("I-"+str(highway_number),"is primary, going east/west.") else: print("I-"+str(highway_number),"is primary, going north/south.") elif(highway_number>=100 and highway_number<=999): highway_number_string = str(highway_number) length = len(highway_number_string) rightmost_digits = int(highway_number_string[length-2:length]) if(rightmost_digits==0): print(highway_number,"is not a valid interstate highway number.") elif(rightmost_digits%2==0): print("I-"+str(highway_number),"is auxiliary, serving I-",rightmost_digits,"going east/west.") else: print("I-"+str(highway_number),"is auxiliary, serving I-",rightmost_digits,"going north/south.")else: print(highway_number,"is not a valid interstate highway number.") i am getting whitespace error on output : I-290 is auxiliary, serving I- 90 going…arrow_forwardPLEASE HELP ME RUN THIS CODE #include <iostream>#include <string>using namespace std;string player1,player2,word,underscore,guess;int wrong=0;int main (){string copy = word; cout << "----------------------Hello! Welcome to the HANGMAN game!---------- ----------" << endl;cout << "Please type in your name, PLAYER 1" << endl;cin >> player1;cout << "Please type in your name, PLAYER 2" << endl;cin >> player2;cout << "OK " << player1 << " and " << player2 << ". Let's start with the game!" << endl;cout << player1 << " please input the word you want " << player2 << " to guess." << endl; cin >> word; //spacefor (int x=0; x<30; x++){cout << endl;} //UNDERSCOREwhile (underscore.size() != word.size()){underscore.push_back('_');} cout << underscore << endl; //MAIN WHILEwhile(wrong<12){cin >> guess; //IF GUESS ISNT…arrow_forward
- Question: Need to add comments to every line. (C++) #include iostream using namespace std; int main(){int num1, num2;double length;double width;double area; double result;char ch;string myStr;length 4;width 8;area= length * width;num1 = 5;num2 = 7;result = static_cast<double>(num2)/num1cout << "7 / 5 is" << result << endl;cout <<"Enter a character: ";cin >> ch;cout << endl;cout <<"Enter the length of the rectangle: ";cin >> length;cout << endl;cout << "Enter the width of the rectangle: ";cin >>width;cout <<endl;cin.get(ch);cout <<"Enter a sentence: ";getline(cin, myStr);cout << endl;area = length * width;cout <<"The area of the rectangle is " << area << endl;cout << myStr << endl;return 0}arrow_forwardCreate a flowchart that is attached below. #include<iostream> #include<math.h> #include <string> using namespace std; int main () { float b,h,r,x,y,PI; int choice; char ans='N'; do { cout<<" Calculator \n\n"; cout<<"Operations\t"<<"\tTrigonometric Functions\t"<<"\tUnit Conversion\t"<<"\tArea\t"<<"\tLogarithmic Functions"<<"\t\tSystem of linear Equation \n\n"; cout<<"1: Addition\t\t"<<"7: Sin\t\t"<<"\t\t13: Km to m\t"<<"\t19: Triangle\t"<<"23: Ln\t\t"<<"\t\t25: 1 Variable"<<endl; cout<<"2: subtraction\t\t"<<"8: Cos\t\t"<<"\t\t14: M to cm\t"<<"\t20: Rectangle\t"<<"24: Log"<<endl; cout<<"3: Multiplication\t"<<"9: Tan\t\t"<<"\t\t15: Cm to mm\t"<<"\t21: Circle\t"<<endl; cout<<"4:…arrow_forwardWrite a code snippet that can arrange the alphabets of a name entered by user in alternatecases. Note: Ignore white spacesarrow_forward
- Integer variable numMinutes is read from input. Type cast numMinutes to a double. Ex: If the input is 90, then the output is: 90.00 #include <iostream>#include <iomanip>using namespace std; int main() { int numMinutes; cin >> numMinutes; cout << fixed << setprecision(2) << /* Your code goes here */ << endl; return 0;}arrow_forwardError; the string "int16_t" and "int8_t" must occur somewhere in your code. where to put those string into he code Here is my code: #include <stdio.h> typedef struct define { short mantissa; char exponent; } Float24_t;arrow_forward// NewMultiply.cpp - This program prints the numbers 0 through 10 along // with these values multiplied by 2 and by 10. // Input: None // Output: Prints the numbers 0 through 10 along with their values multiplied by 2 and by 10. #include <iostream> #include <string> using namespace std; int main() { string head1 = "Number: "; string head2 = "Multiplied by 2: "; string head3 = "Multiplied by 10: "; int numberCounter; // Numbers 0 through 10 int byTen; // Stores the number multiplied by 10 int byTwo; // Stores the number multiplied by 2 const int NUM_LOOPS = 10; // Constant used to control loop // This is the work done in the housekeeping() function cout << "0 through 10 multiplied by 2 and by 10." << endl; // This is the work done in the detailLoop() function // Write your for loop here. // This is the work done in the endOfJob() function return 0; } // End of main()arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Expressions in C++ | C++ tutorial for beginners; Author: Tutorial Mart;https://www.youtube.com/watch?v=XHbsZGpmRc8;License: Standard YouTube License, CC-BY
expression in python # python expressions; Author: Abhishek Tripathi;https://www.youtube.com/watch?v=Cc-kJGRjH6k;License: Standard Youtube License