Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 1, Problem 9MC
Program Description Answer
The comments are intended for understanding the statements of code. The comments will not increase the efficiency of the program.
Hence, the correct option is “a”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
5-
Which part of the following expression is evaluated first by the Python interpreter?
(1 + 3 / 5) * 6 - 2
a.
1 + 3
b.
3 / 5
c.
6 - 2
d.
5 * 6
2- Write a Python program that determines a student’s grade. The program will read three types of scores(quiz, midterm, final exam scores) and determine the grade based on the following rules :
if the average score >=90% =>grade=A
-if the average score >= 70% and <90% => grade=B
-if the average score>=50% and <70% =>grade=C
-if the average score<50% =>grade=F
Example
Input :
Quiz score: 80
Mid-term score: 68
Final score: 90
Output:
Your grade is B.
Hello! I am using python for this calendar program but it doesn't work pls. help me. Thank you.
Here is the code
# Calendar Year Program (Final Version)
#initialization
terminate = False
days_in_month = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
month_names = ('January','February','March','April','May','June','July','August','September','October','November','December')
calendar_year = []
month_separator = format(' ', '8')
blank_week = format(' ', '21')
blank_col = format(' ', '3')
# prompt for years until quit
while not terminate:
# program greeting
print('This program will display a calendar year for a given year')
# get year
year = int(input('Enter year (yyyy) (-1 to quit): '))
while (year < 1800 or year > 2099) and year != -1:
year = int(input('INVALID - Enter year (1800-2099): '))
if year == -1:
terminate = True
else:
# determine if leap year
if (year % 4 == 0) and (not(year % 100 == 0) or (year % 400 ==…
Chapter 1 Solutions
Python Programming: An Introduction to Computer Science, 3rd Ed.
Ch. 1 - Prob. 1TFCh. 1 - Prob. 2TFCh. 1 - Prob. 3TFCh. 1 - Prob. 4TFCh. 1 - Prob. 5TFCh. 1 - Prob. 6TFCh. 1 - Prob. 7TFCh. 1 - Prob. 8TFCh. 1 - Prob. 9TFCh. 1 - Prob. 10TF
Ch. 1 - Prob. 1MCCh. 1 - Prob. 2MCCh. 1 - Prob. 3MCCh. 1 - Prob. 4MCCh. 1 - Prob. 5MCCh. 1 - Prob. 6MCCh. 1 - Prob. 7MCCh. 1 - Prob. 8MCCh. 1 - Prob. 9MCCh. 1 - Prob. 10MCCh. 1 - Prob. 1DCh. 1 - Prob. 2DCh. 1 - Prob. 3DCh. 1 - Prob. 4DCh. 1 - Prob. 5DCh. 1 - Prob. 1PECh. 1 - Prob. 2PECh. 1 - Prob. 3PECh. 1 - Prob. 4PECh. 1 - Prob. 5PECh. 1 - Prob. 7PE
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
- Let a = “Hello World”The Python statement: print(a.replace(a[-2],a[-1])) will write to the console _________:•Selected:a. Hello World. This answer is incorrect.•b. Heddo Wordd•c. Hello Worrd•d. Herro World. I have reviewed all the material, but to me, this reads to replace the second to the last character with the last character from the string. Can you please explain to me how to complete this problem in Python?arrow_forward49.What will be the output of the following Python code snippet? a='hi' q=10 vars() i) {‘a’ : ‘hi’, ‘q’ : 10, ……..plus built-in names set by Python….} ii) {……Built in names set by Python……} iii) {‘a’ : ‘hi’, ‘q’ : 10} iv) Errorarrow_forwardIn Python: The line endings are missing. Usually a gift line ends with a comma (","), but the last one ends with a period (".") , and the next-to-last ends with "and". Write an if-elifelse to add (+) a comma, a period, or and. code: gifts = ['partridge in a pear tree','turtle doves','french hens','colly birds','gold rings','geese a-laying','swans a-swimming','maids a-milking','ladies dancing','lords a-leaping','pipers piping','drummers drumming'] ordinals = ['first', 'second', 'third', 'fourth','fifth', 'sixth', 'seventh', 'eighth','ninth', 'tenth', 'eleventh', 'twelvth'] numerals = ['a', 'two', 'three', 'four', 'five', 'six', 'seven','eight', 'nine', 'ten', 'eleven', 'twelve']#numerals=numerals[0].title() first_verse = 'On the X day of Christmas my true love sent to me' # Your work begins here.# RULES:# 1. Your program must use the variables declared above# 2. Your program may only use these string literals:# "." "," "and" ""# All other strings must be obtained from the variables…arrow_forward
- Consider the following python code. What will be printed by the last print statement? Question 2 options: a. 7 34 b. False c. True d. error e. None of these opions f. 3 4 34arrow_forwardWhich of the following pieces of code will not be accepted by the Python interpreter? Select one -print(True + 10) -float(10e.1) -print(int(‘50’,8)) -print(int(‘10’,16))arrow_forward2. A fine dine-in restaurant charges a 15% service charge and a 10% sales tax on the gross bill. Write a python program that would input the gross bill of the customer and the amount tendered by the customer to the waiter. Display the customer’s gross bill, taxes, and charges as well as the customer’s change.arrow_forward
- The following question requires students to use Python. Thanks in advancearrow_forwardPython code fragment below, fix any error and give the output. Basic question, kindly help! toys = ['ball', 'car', 'soldier'] stuff = toys stuff.popper() print(toys)arrow_forwardNeed help regarding my code, this code is using Python 3 coding a triangle inside a triangle. And my triangle seems to have a space first before the triangle but we are expected to have it (see photo) as the expected output. Appreciate it a lot!arrow_forward
- You are given a table, hotel_ratings, where each row takes the form [hotel_name, number_of_reviews, rating). You are tasked with finding the number of hotels with a rating over three, and has been reviewed at least 30 times. Write a Python code that calculates the number of hotels satisfying above conditions.arrow_forwardThis is my 4th time posting this question and all the other times have been incorrect, please help. The code on the right came with the program and I am meant to modify it. Python.arrow_forwardPlease write a Python program which accepts a sentence (input via keyboard), and convert uppercase letters to lowercase, and convert lowercase letters to uppercase, keep all other characters no change. For example: You input from keyboard: input: "Welcome 2022 ! " output: "wELCOME 2022 ! "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
Algebraic Expressions – Algebra Basics; Author: TabletClass Math;https://www.youtube.com/watch?v=U-7nq7OG18s;License: Standard YouTube License, CC-BY
Python Tutorial for Beginners 3 - Basic Math, Mathematical Operators and Python Expressions; Author: ProgrammingKnowledge;https://www.youtube.com/watch?v=Os4gZUI1ZlM;License: Standard Youtube License