540 likes | 547 Views
For more course tutorials visit<br>www.tutorialrank.com<br><br>CYB 130 Week 1 Discussion zyBooks Reflection<br><br>CYB 130 Week 2 Discussion Code Structure<br><br>CYB 130 Week 3 Discussion Loop Statements<br><br>CYB 130 Week 4 Discussion Containers<br><br>CYB 130 Week 5 Discussion Handling Errors<br>
E N D
CYB 130 All DQs For more course tutorials visit www.tutorialrank.com CYB 130 Week 1 Discussion zyBooks Reflection CYB 130 Week 2 Discussion Code Structure CYB 130 Week 3 Discussion Loop Statements CYB 130 Week 4 Discussion Containers CYB 130 Week 5 Discussion Handling Errors ============================================== CYB 130 All Lab Work For more course tutorials visit
www.tutorialrank.com CYB 130 Week 1 Python LAB 2.14 Formatted output Hello World! CYB 130 Week 1 Python LAB 2.15 Formatted output No parking sign CYB 130 Week 1 Python LAB 2.16 Input Welcome message CYB 130 Week 1 Python LAB 2.29 Divide by x CYB 130 Week 1 Python LAB 2.30 Driving costs CYB 130 Week 1 Python LAB 2.31 Expression for calories burned during workout CYB 130 Week 1 Python LAB 2.32 Using math functions CYB 130 Week 2 Python LAB 3.11 Input and formatted output Right- facing arrow CYB 130 Week 2 Python LAB 3.12 Phone number breakdown CYB 130 Week 2 Python LAB 3.13 Input and formatted output House real estate summary CYB 130 Week 2 Python LAB 3.14 Simple statistics CYB 130 Week 2 Python LAB 3.25 Smallest number CYB 130 Week 2 Python LAB 3.26 Seasons CYB 130 Week 2 Python LAB 3.27 Exact change CYB 130 Week 2 Python LAB 3.28 Leap year
CYB 130 Week 3 Python LAB 4.14 LAB Count input length without spaces, periods, or commas CYB 130 Week 3 Python LAB 4.15 Password modifier CYB 130 Week 3 Python LAB 4.17 Print string in reverse CYB 130 Week 3 Python LAB 4.18 Smallest and largest numbers in a list CYB 130 Week 3 Python LAB 4.19 Output values in a list below a user defined amount CYB 130 Week 4 Python LAB 5.18 Miles to track laps CYB 130 Week 4 Python LAB 5.19 Driving costs - functions CYB 130 Week 4 Python LAB 5.20 Step counter CYB 130 Week 4 Python LAB 5.21 Leap year - functions CYB 130 Week 4 Python LAB 5.22 Swapping variables CYB 130 Week 4 Python LAB 5.23 Exact change - functions CYB 130 Week 4 Python LAB 5.24 Even/odd values in a list CYB 130 Week 5 Python LAB 6.24 Varied amount of input data CYB 130 Week 5 Python LAB 6.25 Filter and sort a list CYB 130 Week 5 Python LAB 6.26 Elements in a range
CYB 130 Week 5 Python LAB 6.5 Checker for integer string CYB 130 Week 5 Python LAB 6.6 Name format CYB 130 Week 5 Python LAB 6.7 Palindrome CYB 130 Week 5 Python LAB 6.8 Acronyms ============================================== CYB 130 Week 1 Discussion zyBooks Reflection For more course tutorials visit www.tutorialrank.com Respond to the following in a minimum of 175 words: Now that you have spent one week navigating your zyBook, what observations have you made about its design? Which elements were most helpful to you? Which features are still troublesome? What strategies have you applied that could be of use to someone else? Describe another situation in which zyBooks could help you learn content. ==============================================
CYB 130 Week 1 Python LAB 2.14 Formatted output Hello World! For more course tutorials visit www.tutorialrank.com CYB 130 Week 1 Python LAB 2.14 Formatted output Hello World! Write a program that outputs "Hello World!" For ALL labs, end with newline (unless otherwise stated). ============================================== CYB 130 Week 1 Python LAB 2.15 Formatted output No parking sign For more course tutorials visit www.tutorialrank.com CYB 130 Week 1 Python LAB 2.15 Formatted output No parking sign
Write a program that prints a formatted "No parking" sign as shown below. Note the first line has two leading spaces. For ALL labs, end with newline (unless otherwise stated). NO PARKING 200 - 600 a.m. ============================================== CYB 130 Week 1 Python LAB 2.16 Input Welcome message For more course tutorials visit www.tutorialrank.com CYB 130 Week 1 Python LAB 2.16 Input Welcome message Write a program that takes a first name as the input, and outputs a welcome message to that name.
Ex If the input is Pat, the output is Hello Pat and welcome to CS Online! ============================================== CYB 130 Week 1 Python LAB 2.29 Divide by x For more course tutorials visit www.tutorialrank.com CYB 130 Week 1 Python LAB 2.29 Divide by x Write a program using integers user_num and x as input, and output user_num divided by x three times. Ex If the input is
2000 2 Then the output is 1000 500 250 Note In Python 3, integer division discards fractions. Ex 6 // 4 is 1 (the 0.5 is discarded). ============================================== CYB 130 Week 1 Python LAB 2.30 Driving costs For more course tutorials visit www.tutorialrank.com CYB 130 Week 1 Python LAB 2.30 Driving costs Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows print('{.2f} {.2f} {.2f}'.format(your_value1, your_value2, your_value3)) Ex If the input is 20.0 3.1599 Then the output is 3.16 11.85 79.00 Note Real per-mile cost would also include maintenance and depreciation. ============================================== CYB 130 Week 1 Python LAB 2.31 Expression for calories burned during workout For more course tutorials visit
www.tutorialrank.com CYB 130 Week 1 Python LAB 2.31 Expression for calories burned during workout The following equations estimate the calories burned when exercising (source) Women Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Men Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184
Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men. Output each floating-point value with two digits after the decimal point, which can be achieved as follows print('Men {.2f} calories'.format(calories_man)) Ex If the input is 49 155 148 60 Then the output is
Women 580.94 calories Men 891.47 calories ============================================== CYB 130 Week 1 Python LAB 2.32 Using math functions For more course tutorials visit www.tutorialrank.com CYB 130 Week 1 Python LAB 2.32 Using math functions Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolute value of (x minus y), and the square root of (x to the power of z). Output each floating-point value with two digits after the decimal point, which can be achieved as follows
print('{.2f} {.2f} {.2f} {.2f}'.format(your_value1, your_value2, your_value3, your_value4)) Ex If the input is 5.0 1.5 3.2 Then the output is 172.47 361.66 3.50 13.13 ============================================== CYB 130 Week 2 Discussion Code Structure For more course tutorials visit www.tutorialrank.com Respond to the following in a minimum of 175 words:
This week you will learn about basic code structure. The term structure, as it relates to programming, refers to the decisions you make to design your program to best meet its objective. Python provides features to create clean, efficient code. How can the basic if/elif/else control statements help meet structural design objectives in your code? Provide a code example to support your comments. ============================================== CYB 130 Week 2 Python LAB 3.11 Input and formatted output Right-facing arrow For more course tutorials visit www.tutorialrank.com CYB 130 Week 2 Python LAB 3.11: Input and formatted output: Right- facing arrow Given input characters for an arrowhead and arrow body, print a right- facing arrow.
Ex: If the input is: * # Then the output is: # ******## ******### ******## # ============================================== CYB 130 Week 2 Python LAB 3.12 Phone number breakdown For more course tutorials visit www.tutorialrank.com CYB 130 Week 2 Python LAB 3.12: Phone number breakdown Given an integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212.
Ex: If the input is: 8005551212 the output is: (800) 555-1212 Hint: Use % to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which is 72. Hint: Use // to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 // 100, which yields 5. (Recall integer division discards the fraction).
For simplicity, assume any part starts with a non-zero digit. So 0119998888 is not allowed. ============================================== CYB 130 Week 2 Python LAB 3.13 Input and formatted output House real estate summary For more course tutorials visit www.tutorialrank.com CYB 130 Week 2 Python LAB 3.13: Input and formatted output: House real estate summary Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (current_price * 0.051) / 12. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value)) Ex: If the input is: 200000 210000 the output is: This house is $200000. The change is $-10000 since last month. The estimated monthly mortgage is $850.00. Note: Getting the precise spacing, punctuation, and newlines exactly right is a key point of this assignment. Such precision is an important part of programming. ==============================================
CYB 130 Week 2 Python LAB 3.14 Simple statistics For more course tutorials visit www.tutorialrank.com CYB 130 Week 2 Python LAB 3.14: Simple statistics Given 4 floating-point numbers. Use a string formatting expression with conversion specifiers to output their product and their average as integers (rounded), then as floating-point numbers. Output each rounded integer using the following: print('{:.0f}'.format(your_value))
Output each floating-point value with three digits after the decimal point, which can be achieved as follows: print('{:.3f}'.format(your_value)) Ex: If the input is: 8.3 10.4 5.0 4.8 the output is: 2072 7 2071.680 7.125 ============================================== CYB 130 Week 2 Python LAB 3.25 Smallest number For more course tutorials visit
www.tutorialrank.com CYB 130 Week 2 Python LAB 3.25: Smallest number Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15 3 the output is: 3 ============================================== CYB 130 Week 2 Python LAB 3.26 Seasons For more course tutorials visit
www.tutorialrank.com CYB 130 Week 2 Python LAB 3.26: Seasons Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. Ex: If the input is: April 11 the output is: Spring In addition, check if the string and int are valid (an actual month and day).
Ex: If the input is: Blue 65 the output is: Invalid The dates for each season are: Spring: March 20 - June 20 Summer: June 21 - September 21 Autumn: September 22 - December 20 Winter: December 21 - March 19 ============================================== CYB 130 Week 2 Python LAB 3.27 Exact change For more course tutorials visit
www.tutorialrank.com CYB 130 Week 2 Python LAB 3.27: Exact change Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is:
45 the output is: 1 Quarter 2 Dimes ============================================== CYB 130 Week 2 Python LAB 3.28 Leap year For more course tutorials visit www.tutorialrank.com CYB 130 Week 2 Python LAB 3.28: Leap year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016.
Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is: 1712 the output is: 1712 - leap year Ex: If the input is: 1913 the output is: 1913 - not a leap year ==============================================
CYB 130 Week 3 Discussion Loop Statements For more course tutorials visit www.tutorialrank.com Respond to the following in a minimum of 175 words: Most programming languages provide loop statements that help users iteratively process code. In Python you can write loops that handle many situations. What is the intuition behind using a loop statement? What do you gain from using loops in your code? Provide a code example to support your comments. ============================================== CYB 130 Week 3 Python LAB 4.14 LAB Count input length without spaces, periods, or commas For more course tutorials visit www.tutorialrank.com
CYB 130 Week 3 Python LAB 4.14 LAB: Count input length without spaces, periods, or commas Given a line of text as input, output the number of characters excluding spaces, periods, or commas. Ex: If the input is: Listen, Mr. Jones, calm down. the output is: 21
Note: Account for all characters that aren't spaces, periods, or commas (Ex: "r", "2", "!"). ============================================== CYB 130 Week 3 Python LAB 4.15 Password modifier For more course tutorials visit www.tutorialrank.com CYB 130 Week 3 Python LAB 4.15: Password modifier Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string. i becomes ! a becomes @ m becomes M
B becomes 8 o becomes . Ex: If the input is: mypassword the output is: Myp@ssw.rdq*s Hint: Python strings are immutable, but support string concatenation. Store and build the stronger password in the given password variable. ==============================================
CYB 130 Week 3 Python LAB 4.17 Print string in reverse For more course tutorials visit www.tutorialrank.com CYB 130 Week 3 Python LAB 4.17: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey
quit then the output is: erehtolleH yeH ============================================== CYB 130 Week 3 Python LAB 4.18 Smallest and largest numbers in a list For more course tutorials visit www.tutorialrank.com CYB 130 Week 3 Python LAB 4.18: Smallest and largest numbers in a list
Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smallest and largest integers in the list. Ex: If the input is: 10 5 3 21 2 -6 the output is: 2 21
You can assume that the list of integers will have at least 2 values. ============================================== CYB 130 Week 3 Python LAB 4.19 Output values in a list below a user defined amount For more course tutorials visit www.tutorialrank.com CYB 130 Week 3 Python LAB 4.19: Output values in a list below a user defined amount Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value.
Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75
The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. Such functionality is common on sites like Amazon, where a user can filter results. ============================================== CYB 130 Week 4 Discussion Containers For more course tutorials visit www.tutorialrank.com Respond to the following in a minimum of 175 words: Python lists are commonly used to store data types. Lists are a collection of information typically called a container. Think of a physical container that can hold all kinds of objects, not just one object of the same type. Python includes a built-in list type called a list. They can be managed by
many built-in functions that help fill, iterate over, add to, and delete a list. Why is it useful to store information with different data types? When do you choose to use a list over a dictionary? Provide a code example that supports your comments. ============================================== CYB 130 Week 4 Python LAB 5.18 Miles to track laps For more course tutorials visit www.tutorialrank.com CYB 130 Week 4 Python LAB 5.18: Miles to track laps One lap around a standard high-school running track is exactly 0.25 miles. Write the function miles_to_laps() that takes a number of miles as an argument and returns the number of laps. Complete the program to output the number of laps. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value)) Ex: If the input is: 1.5 the output is: 6.00 Ex: If the input is: 2.2 the output is: 8.80
Your program must define and call the following function: def miles_to_laps(user_miles) ============================================== CYB 130 Week 4 Python LAB 5.19 Driving costs – functions For more course tutorials visit www.tutorialrank.com CYB 130 Week 4 Python LAB 5.19: Driving costs - functions Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f}'.format(your_value)) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles.
Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles. Note: This is a lab from a previous chapter that now requires the use of a function. ============================================== CYB 130 Week 4 Python LAB 5.20 Step counter
For more course tutorials visit www.tutorialrank.com CYB 130 Week 4 Python LAB 5.20: Step counter A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value)) Ex: If the input is: 5345 the output is:
2.67 Your program must define and call the following function. The function should return the amount of miles walked. def steps_to_miles(user_steps) ============================================== CYB 130 Week 4 Python LAB 5.21 Leap year – functions For more course tutorials visit www.tutorialrank.com CYB 130 Week 4 Python LAB 5.21: Leap year - functions A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are:
1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is: 1712 the output is: 1712 is a leap year. Ex: If the input is: 1913 the output is:
1913 is not a leap year. Your program must define and call the following function. The function should return true if the input year is a leap year and false otherwise. def is_leap_year(user_year) Note: This is a lab from a previous chapter that now requires the use of a function. ============================================== CYB 130 Week 4 Python LAB 5.22 Swapping variables For more course tutorials visit www.tutorialrank.com
CYB 130 Week 4 Python LAB 5.22: Swapping variables Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 the output is: 8 3 Your program must define and call the following function. swap_values() returns the two values in swapped order. def swap_values(user_val1, user_val2) ==============================================
cyb 130 week 4 python lab 5.23 exact change – functions For more course tutorials visit www.tutorialrank.com CYB 130 Week 4 Python LAB 5.23: Exact change - functions Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change
Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies. def exact_change(user_total) Note: This is a lab from a previous chapter that now requires the use of a function. ============================================== CYB 130 Week 4 Python LAB 5.24 Even/odd values in a list
For more course tutorials visit www.tutorialrank.com CYB 130 Week 4 Python LAB 5.24: Even/odd values in a list Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither. The input begins with an integer indicating the number of integers that follow. Ex: If the input is: 5 2 4 6 8 10 the output is:
all even Ex: If the input is: 5 1 3 5 7 9 the output is: all odd Ex: If the input is: 5