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 5, Problem 11MC
A variable that is visible to every function in a
a. local variable
b. universal variable
c. program-wide variable
d. global variable
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule03:35
Students have asked these similar questions
printTodaysDate is a function that accepts no parameters and returns no value.
Write a statement that calls printTodaysDate.
_______ are variables available only within the body of a declared function.
A. Arguments
B. Globals
C. Parameters
D. Locals
DAT6
The only allowed external libraries/functions are:
stdio.h:
> printf()
> scanf()
Please use Visual Studio Code and C programming language.
Chapter 5 Solutions
Starting Out with Python (4th Edition)
Ch. 5.1 - What is a function?Ch. 5.1 - Prob. 2CPCh. 5.1 - How do functions help you reuse code in a program?Ch. 5.1 - How can functions make the development of multiple...Ch. 5.1 - How can functions make it easier for programs to...Ch. 5.2 - A function definition has what two parts?Ch. 5.2 - What does the phrase calling a function mean?Ch. 5.2 - When a function is executing, what happens when...Ch. 5.2 - Prob. 9CPCh. 5.4 - What is a local variable? How is access to a local...
Ch. 5.4 - What is a variables scope?Ch. 5.4 - Prob. 12CPCh. 5.5 - What are the pieces of data that are passed into a...Ch. 5.5 - What are the variables that receive pieces of data...Ch. 5.5 - Prob. 15CPCh. 5.5 - When a parameter is changed, does this affect the...Ch. 5.5 - The following statements call a function named...Ch. 5.6 - What is the scope of a global variable?Ch. 5.6 - Give one good reason that you should not use...Ch. 5.6 - Prob. 20CPCh. 5.7 - How does a value-returning function differ from...Ch. 5.7 - Prob. 22CPCh. 5.7 - Prob. 23CPCh. 5.7 - What does the following statement do? x =...Ch. 5.7 - What does the following statement do? print...Ch. 5.7 - What does the following statement do? print...Ch. 5.7 - What does the following statement do? print...Ch. 5.7 - What does the following statement do? print...Ch. 5.7 - When the random module is imported, what does it...Ch. 5.7 - What happens if the same seed value is always used...Ch. 5.8 - Prob. 31CPCh. 5.8 - Look at the following function definition: def...Ch. 5.8 - What is a Boolean function?Ch. 5.9 - What import statement do you need to write in a...Ch. 5.9 - Write a statement that uses a math module function...Ch. 5.9 - Write a statement that uses a math module function...Ch. 5 - A group of statements that exist within a program...Ch. 5 - A design technique that helps to reduce the...Ch. 5 - The first line of a function definition is known...Ch. 5 - You___a function to execute it. a. define b. call...Ch. 5 - A design technique that programmers use to break...Ch. 5 - Prob. 6MCCh. 5 - A ______ is a variable that is created inside a...Ch. 5 - Prob. 8MCCh. 5 - Prob. 9MCCh. 5 - Prob. 10MCCh. 5 - A variable that is visible to every function in a...Ch. 5 - Prob. 12MCCh. 5 - This is a prewritten function that is built into a...Ch. 5 - This standard library function returns a random...Ch. 5 - This standard library function returns a random...Ch. 5 - This standard library function returns a random...Ch. 5 - This statement causes a function to end and sends...Ch. 5 - This is a design tool that describes the input,...Ch. 5 - This type of function returns either True or...Ch. 5 - This is a math module function. a. derivative b....Ch. 5 - The phrase "divide and conquer" means that all of...Ch. 5 - Functions make it easier for programmers to work...Ch. 5 - Function names should be as short as possible.Ch. 5 - Calling a function and defining a function mean...Ch. 5 - A flowchart shows the hierarchical relationships...Ch. 5 - A hierarchy chart does not show the steps that are...Ch. 5 - A statement in one function can access a local...Ch. 5 - In Python, you cannot write functions that accept...Ch. 5 - In Python, you can specify which parameter an...Ch. 5 - You cannot have both keyword arguments and...Ch. 5 - Some library functions are built into the Python...Ch. 5 - You do not need to have an import statement in a...Ch. 5 - Complex mathematical expressions can sometimes be...Ch. 5 - A function in Python can return more than one...Ch. 5 - IPO charts provide only brief descriptions of a...Ch. 5 - How do functions help you to reuse code in a...Ch. 5 - Name and describe the two parts of a function...Ch. 5 - When a function is executing, what happens when...Ch. 5 - What is a local variable? What statements are able...Ch. 5 - What is a local variable's scope?Ch. 5 - Prob. 6SACh. 5 - Suppose you want to select a random number from...Ch. 5 - What statement do you have to have in a...Ch. 5 - What three things are listed on an IPO chart?Ch. 5 - What is a Boolean function?Ch. 5 - Prob. 11SACh. 5 - Write a function named times_ten. The function...Ch. 5 - Examine the following function header, then write...Ch. 5 - Look at the following function header: der...Ch. 5 - What will the following program display? def main...Ch. 5 - Look at the following function definition def...Ch. 5 - Write a statement that generates a random number...Ch. 5 - The following statement calls a function named...Ch. 5 - A program contains the following function...Ch. 5 - Write a function named times_ten that accepts a...Ch. 5 - Write a function named get_first_name that asks...Ch. 5 - Kilometer Converter The Kilometer Converter...Ch. 5 - Sales Tax Program Refactoring Programming Exercise...Ch. 5 - How Much Insurance? Many financial experts advise...Ch. 5 - Automobile Costs Write a program that asks the...Ch. 5 - Property Tax A county collects property taxes on...Ch. 5 - Calories from Fat and Carbohydrates A nutritionist...Ch. 5 - Stadium Seating There are three seating categories...Ch. 5 - Paint Job Estimator A painting company has...Ch. 5 - Monthly Sales Tax A retail company must file a...Ch. 5 - Feet to Inches The Feet to Inches Problem One foot...Ch. 5 - Math Quiz Write a program that gives simple math...Ch. 5 - Maximum of Two Values Write a function named max...Ch. 5 - Falling Distance When an object is falling because...Ch. 5 - Kinetic Energy In physics, an object that is in...Ch. 5 - Test Average and Grade Write a program that asks...Ch. 5 - Odd/Even Counter In this chapter, you saw an...Ch. 5 - Prime Numbers A prime number is a number that is...Ch. 5 - Prime Number List This exercise assumes that you...Ch. 5 - Future Value Suppose you have a certain amount of...Ch. 5 - Random Number Guessing Game Write a program that...Ch. 5 - Rock, Paper, Scissors Game Write a program that...Ch. 5 - Turtle Graphics: Triangle Function Write a...Ch. 5 - Turtle Graphics: Modular Snowman Write a program...Ch. 5 - Prob. 24PECh. 5 - Turtle Graphics: Checkerboard Write a turtle...Ch. 5 - Turtle Graphics: City Skyline Write a turtle...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
What Ada construct provides support for abstract data types?
Concepts of Programming Languages (11th Edition)
Name the steps in the programming process.
Digital Fundamentals (11th Edition)
1. Read the problem statement. 2. Formulate the algorithm using pseudocode and top-down, stepwise refinement. 3...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
When displaying a Java applet, the browser invokes the _____ to interpret the bytecode into the appropriate mac...
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Pay Period Gross Pay A particular employee earns 39,000 annually. Write a program that determines and displays ...
Starting Out with C++: Early Objects (9th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th 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
- When you try to access to a local variable outside the function an error is generatedSelect one:a. Falseb. Truearrow_forward# Write your code below each prompt# Create a function called ex2() which:# 1. Prompts the user for their name# 2. Writes the text entry to the file tmp1.txt# 3. Reads the value from the file# 4. Print the value read from the file# 5. Invoke ex2() to print resultsarrow_forwardExpense Pie Chart (in python) Create a text file that contains your expenses for last month in the following categories: -Rent -Gas -Food -Clothing -Car Payment -Misc Write a Python program that reads the data from the file and uses matplotlib to plot a pie chart showing you how you spend your money.arrow_forward
- C++ Visual 2019 A file called num.txt. write a C++ program that opens a file, reads all the numbers from the file and calculates the following: The number of numbers in the file The sum of all the numbers in the file (a running total) The average of all the numbers in the file The program should display the number of numbers found in the file, the sum of the numbers and the average of the numbers. These are the numbers in the num.txt file :…arrow_forwardCharacter Analysis Create a source code text file and save it as named text.txt. Write a program that reads the file's contents and determines the following: - The number of uppercase letters in the file. - The number of lowercase letters in the file. - The number of digits in the file. - The number of whitespace characters in the file. * Note: Please be sure to use the Python program when creating the program. Thanks!arrow_forwardExercise 3 – Roman Numerals Exercise Tasks: Create a visual studio C++ project exercise3 and submit the cpp file when completed Create a C++ program that converts integers between 1 and 3999 into the corresponding roman numerals. Your solution should print an error message for incorrect input. The following roman numeral conversions should prove useful: 1. I 6. VI 50. L 900. CM2. II 9. IX 90. XC 1000. M4. IV 10. X 100. C 5. V 40. XL 500 D. Modify the following tester code to obtain an integer from the user and check that it is between 1 and 3999. Then print out the corresponding roman numerals. While the sample code uses an ifthenelse, you could also use a switch statement. /****************************************************** * Roman Numeral Converter August 13 * converts base 10 positive integer >=0 <4000 to roman numerals * @author <your name here> */ #include <iostream> using…arrow_forward
- Python Create a text file named “Books.txt”.Open the text file and add the name of at least two books.In your Python3 code file, create a function that will loop through and display a menuwith options to Display, Add, Exit. It will end once the user selects the option for exit.Create another function that will accept the user’s choice with the outcome for eachoption.Display – read the file and output each lineAdd – prompt the user for a book name and append it to the file. Exit – close the file and exit the loopRun the code to display your output.arrow_forwardA function is similar to a procedure or sub-module but a function can do this _________ while a procedure or sub-module cannot. A)RUN CODE B)RUN A SUB PROGRAM C)RETURN A VALUE D)PRINT TO THE SCREEN In a text file, this is written to the file after each item A)EOF B)DELIMITER C)EOL D)TXT Inheritance allowsarrow_forwardQ7: In the function files the output arguments must be typed inside: O Box brackets O Angle brackets O Round brackets O Curly brackets O None of the givenarrow_forward
- python" You have an Internet connection with a download speed of 41 Megabits per second (Mbps) and you want to calculate how long it will take to download a files based on their size. Write a function named "download_time" that takes an integer as a parameter. The parameter represents the size of a file in Gigabytes that you want to download. The function should return the number of seconds it will take to download that file if your download speed is 41 Megabits per second. To convert the file size from Gigabytes to Megabits remember that 1 Gigabyte equals 1000 Megabytes and that 1 Megabyte equals 8 Megabits.arrow_forwardTime remaining: 01:47:21 Computer Science The file numbers.txt contains integer numbers, one number per line. The contents could look like this: 2 45 108 3 - 10 1100 ...etc... Please write a function named largest, which reads the file and returns the largest number in the filearrow_forwardM Gmail O YouTube A Maps S Translate Create a function named "area" that allows the user to calculate the area of a Rectangle, a Disk or a Triangle, as shown in the following Python Shell screenshot. Write a main code that keeps calling the function upon user's approval. You need to upload your Python file. Write your own code, cheating will result in a zero grade. Choose 1: Rectangle, 2: Disk, 3: Triangle: 1 enter height: 4 enter width: 3 Area = 12 do you want to try again? (y/n): y Choose 1: Rectangle, 2: Disk, 3: Triangle: 2 enter radius: 4 Area = 50.26548245743669 do you want to try again? (y/n): y Choose 1: Rectangle, 2: Disk, 3: Triangle: 3 enter base: 5 enter perpendicular height: 4 Area = 10.0 do you want to try again? (y/n): n >>> Do loft 1-14:06arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License