Docsity

WGU C859 PYTHON TEST COMPLETE SOLUTION COMPREHENSIVE SCRIPT, Exams of Reasoning

Toggle sidebar
bg1
⩥ total_purchase_cost. Answer: Total cost of the grocery store items
purchased, adjusted for discounts based on quantity.
⩥ discount for 10-20 items. Answer: If between ten and twenty items
(inclusive) are purchased, the purchase gets a 5% discount.
⩥ discount for 21 or more items. Answer: If twenty-one or more items
are purchased, the purchase gets a 10% discount.
⩥ sentence. Answer: A new sentence string composed of three existing
words from a text file.
⩥ file_name. Answer: The name of a text file or CSV file input by the
user.
⩥ CSV file. Answer: A file containing two rows of comma-separated
values to be imported as dictionaries.
WGU C859 PYTHON TEST COMPLETE
SOLUTION COMPREHENSIVE SCRIPT
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download WGU C859 PYTHON TEST COMPLETE SOLUTION COMPREHENSIVE SCRIPT and more Exams Reasoning in PDF only on Docsity!

⩥ total_purchase_cost. Answer: Total cost of the grocery store items purchased, adjusted for discounts based on quantity. ⩥ discount for 10-20 items. Answer: If between ten and twenty items (inclusive) are purchased, the purchase gets a 5% discount. ⩥ discount for 21 or more items. Answer: If twenty-one or more items are purchased, the purchase gets a 10% discount. ⩥ sentence. Answer: A new sentence string composed of three existing words from a text file. ⩥ file_name. Answer: The name of a text file or CSV file input by the user. ⩥ CSV file. Answer: A file containing two rows of comma-separated values to be imported as dictionaries.

WGU C859 PYTHON TEST COMPLETE

SOLUTION COMPREHENSIVE SCRIPT

⩥ num_stock. Answer: An integer input identifying how many shares of stock are to be purchased. ⩥ item_purchased. Answer: A string input representing a grocery store item. ⩥ num_items. Answer: An integer input identifying the number of items purchased. ⩥ Total price output format. Answer: Output format for stock purchase: Total price: $cost_of_stocks ⩥ Grocery purchase output format. Answer: Output format for grocery purchase: item_purchased $total_purchase_cost ⩥ File read and write. Answer: Using open(), write(), and read() methods to interact with a text file. ⩥ Dictionary creation from CSV. Answer: Creating a dictionary of key:value pairs for each row of comma-separated values in a CSV file. ⩥ Example of stock selection. Answer: TSLA, BBBY, AAPL, SOFI, KIRK, AURA, AMZN, EMBK, LVLU

⩥ code. Answer: Textual representation of a program. ⩥ line. Answer: Row of text. ⩥ prompt. Answer: Indicates the interpreter is ready to accept user input. ⩥ statement. Answer: Line of executable code. ⩥ expression. Answer: Returns a value when evaluated. ⩥ print( ). Answer: Displays output to the screen and starts a new line. ⩥ # or """. Answer: Denotes a comment. ⩥ string literal. Answer: Text enclosed in quotes. ⩥ end=' '. Answer: Keeps multiple print statements on one line. ⩥ type( ). Answer: Determines how a value can behave. ⩥ int( ). Answer: Converts string to an integer.

⩥ syntaxes error. Answer: A violation of the program language rules on how symbols can be defined. ⩥ runtime error. Answer: The program attempts an impossible operation. ⩥ indentation error. Answer: Lines inside the program are not properly indented. ⩥ Value Error. Answer: Invalid value used. ⩥ input_pig_age. Answer: An integer input representing the age of a pig. ⩥ converted_pig_age. Answer: The human equivalent age of a pig calculated using the pigAge_converter() function. ⩥ Reverse Course. Answer: A learning method involving video lectures at home and labs in class ⩥ IPO thinking standard. Answer: Input-Process-Output thinking standard to determine coding structure

⩥ Lists. Answer: Ordered collection of items in Python denoted by square brackets ⩥ Tuples. Answer: Immutable ordered collection of items in Python denoted by parentheses ⩥ Variables and Expressions. Answer: Symbols used to represent values and perform operations ⩥ Functions. Answer: Blocks of organized, reusable code for specific tasks ⩥ Lab Walkthroughs. Answer: Guided demonstrations of critical programming exercises ⩥ Arithmetic Operators. Answer: Symbols used to perform mathematical operations in Python ⩥ Comparisons. Answer: Operations that return true or false based on the comparison of values ⩥ Absolute value function. Answer: Function to obtain the magnitude of an integer, removing the negative sign

⩥ Round function. Answer: Function to round a value to a specified number of digits after the decimal point ⩥ Iteration Statements. Answer: Statements used for repeated execution of instructions in a program ⩥ Codewars. Answer: An educational coding platform for honing programming skills ⩥ Data Camp. Answer: An online platform offering data science and analytics courses ⩥ Springboard Python course. Answer: A comprehensive course for learning Python programming ⩥ Python compiler. Answer: A program that translates Python code into machine code ⩥ Slicing. Answer: Extracting a portion of a sequence like a string or list in Python ⩥ Corey Schaefer. Answer: A notable resource for learning programming through tutorials and guides

⩥ Floor division. Answer: Dividing integers to get the whole number part of the quotient ⩥ Calories burned equation. Answer: Estimates average calories burned based on age, weight, heart rate, and time ⩥ Math functions. Answer: Using math library for operations like power, absolute value, and square root ⩥ Frequency calculation. Answer: Calculating frequencies of keys on a piano based on initial key frequency ⩥ Half-life. Answer: Time taken for a substance to reduce to half its original value ⩥ House real estate summary. Answer: Outputting price change and estimated monthly mortgage based on current and last month's price ⩥ Simple statistics. Answer: Calculating product and average of floating-point numbers, rounding and formatting the output ⩥ Northern hemisphere seasons. Answer: Determining the season based on input date and month, considering days in each month

⩥ Seasons. Answer: Spring: March 20 - June 20, Summer: June 21 - September 21, Autumn: September 22 - December 20, Winter: December 21 - March 19 ⩥ Leap Year. Answer: A year with 366 days, occurring every 4 years and divisible by 4, except for century years not divisible by 400 ⩥ Interstate Highway Numbers. Answer: Primary highways: 1-99, odd for north/south, even for east/west. Auxiliary: 100-999, servicing the rightmost two digits of the primary highway ⩥ Golf Scores. Answer: Score names: 'Eagle' (2 less than par), 'Birdie' ( less), 'Par' (equals par), 'Bogey' (1 more); 'Error' if par not 3, 4, or 5 ⩥ Conditional Statements. Answer: Used for multiple choices. 'if' for an option, 'elif' for alternatives, 'else' as the final option if none apply ⩥ Nested Loops. Answer: Loops within loops, used for complex iterations and operations ⩥ Nested Lists. Answer: Lists within lists, used for organizing and managing complex data structures ⩥ Range Function. Answer: Returns a sequence of numbers, commonly used in for loops

⩥ find(x). Answer: returns the index of the first occurrence of x in the string ⩥ travels. Answer: Distance: total_miles_traveled miles - accepts three integer inputs representing the number of times an employee travels to a job site ⩥ miles_per_employee. Answer: a dictionary containing the miles per employee commute to the job site: {'A': 15.62, 'B': 41.85, 'C': 32.67} ⩥ ounces. Answer: Create a solution that accepts an integer input representing any number of ounces ⩥ Tons: value_1 Pounds: value_2 Ounces: value_3. Answer: output format for ounces conversion based on the input ounces value ⩥ various_data_types. Answer: a list containing [516, 112.49, True, 'meow', ('Western', 'Governors', 'University'), {'apple': 1, 'pear': 5}] ⩥ data_type. Answer: output data type based on the input index value of the list element using type() ⩥ Trapezoid Area Formula. Answer: A = [(b1 + b2) / 2] * h

⩥ area_value. Answer: the exact area of the trapezoid calculated using the trapezoid area formula ⩥ integer_sum_value. Answer: sum of five inputs maintained as integer values ⩥ float_sum_value. Answer: sum of five inputs converted to float values ⩥ string_sum_value. Answer: sum of five inputs converted to string values (concatenate) ⩥