1 / 36

CYB 130 Improved tutorial / newtonhelp.com

For more course tutorials visit<br>www.newtonhelp.com<br><br>CYB 130 Week 1 Python LAB 2.30 Driving costs<br>CYB 130 Week 1 Python LAB 2.16 Input Welcome message<br>CYB 130 Week 1 Python LAB 2.32 Using math functions<br>CYB 130 Week 1 Python LAB 2.31 Expression for calories burned during workout<br>CYB 130 Week 1 Python LAB 2.29 Divide by x<br>CYB 130 Week 1 Python LAB 2.15 Formatted output No parking sign<br>CYB 130 Week 1 Python LAB 2.14 Formatted output Hello World!<br>

king196
Download Presentation

CYB 130 Improved tutorial / newtonhelp.com

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CYB 130 Improved tutorial / newtonhelp.com

  2. CYB 130 Improved tutorial / newtonhelp.com CYB 130 All Lab Work For more course tutorials visit www.newtonhelp.com CYB 130 Week 1 Python LAB 2.30 Driving costs CYB 130 Week 1 Python LAB 2.16 Input Welcome message CYB 130 Week 1 Python LAB 2.32 Using math functions CYB 130 Week 1 Python LAB 2.31 Expression for calories burned during workout CYB 130 Week 1 Python LAB 2.29 Divide by x CYB 130 Week 1 Python LAB 2.15 Formatted output No parking sign CYB 130 Week 1 Python LAB 2.14 Formatted output Hello World! CYB 130 Week 2 Python LAB 3.25 Smallest number

  3. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 1 Python LAB 2.14 Formatted output Hello World! For more course tutorials visit www.newtonhelp.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).

  4. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 1 Python LAB 2.15 Formatted output No parking sign For more course tutorials visit www.newtonhelp.com CYB 130 Week 1 Python LAB 2.15 Formatted output No parking signWrite 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).

  5. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 1 Python LAB 2.16 Input Welcome message For more course tutorials visit www.newtonhelp.com CYB 130 Week 1 Python LAB 2.16 Input Welcome messageWrite 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 isHello Pat and welcome to CS Online!

  6. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 1 Python LAB 2.29 Divide by x For more course tutorials visit www.newtonhelp.com CYB 130 Week 1 Python LAB 2.29 Divide by xWrite a program using integers user_num and x as input, and output user_num divided by x three times. Ex If the input is20002Then the output is1000 500 250Note In Python 3, integer division discards fractions. Ex 6 // 4 is 1 (the 0.5 is discarded).

  7. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 1 Python LAB 2.30 Driving costs For more course tutorials visit www.newtonhelp.com CYB 130 Week 1 Python LAB 2.30 Driving costsDriving 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.

  8. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 1 Python LAB 2.31 Expression for calories burned during workout For more course tutorials visit www.newtonhelp.com CYB 130 Week 1 Python LAB 2.31 Expression for calories burned during workoutThe 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.

  9. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 1 Python LAB 2.32 Using math functions For more course tutorials visit www.newtonhelp.com CYB 130 Week 1 Python LAB 2.32 Using math functionsGiven 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 followsprint('{.2f} {.2f} {.2f} {.2f}'.format(your_value1, your_value2, your_value3, your_value4))

  10. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 2 Python LAB 3.11 Input and formatted output Right-facing arrow For more course tutorials visit www.newtonhelp.com CYB 130 Week 2 Python LAB 3.11: Input and formatted output: Right-facing arrowGiven input characters for an arrowhead and arrow body, print a right-facing arrow. Ex: If the input is:*#Then the output is:      #******##******###******##

  11. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 2 Python LAB 3.12 Phone number breakdown For more course tutorials visit www.newtonhelp.com CYB 130 Week 2 Python LAB 3.12: Phone number breakdownGiven an integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212.

  12. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 2 Python LAB 3.13 Input and formatted output House real estate summary For more course tutorials visit www.newtonhelp.com CYB 130 Week 2 Python LAB 3.13: Input and formatted output: House real estate summarySites 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.

  13. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 2 Python LAB 3.14 Simple statistics For more course tutorials visit www.newtonhelp.com CYB 130 Week 2 Python LAB 3.14: Simple statisticsGiven 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.

  14. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 2 Python LAB 3.25 Smallest number For more course tutorials visit www.newtonhelp.com CYB 130 Week 2 Python LAB 3.25: Smallest numberWrite a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is:7153the output is:3

  15. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 2 Python LAB 3.26 Seasons For more course tutorials visit www.newtonhelp.com CYB 130 Week 2 Python LAB 3.26: SeasonsWrite 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:April11the output is:Spring

  16. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 2 Python LAB 3.27 Exact change For more course tutorials visit www.newtonhelp.com CYB 130 Week 2 Python LAB 3.27: Exact changeWrite 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.

  17. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 2 Python LAB 3.28 Leap year For more course tutorials visit www.newtonhelp.com CYB 130 Week 2 Python LAB 3.28: Leap yearA 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 42) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible

  18. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 3 Python and HTML For more course tutorials visit www.newtonhelp.com CYB 130 Week 3 Python and HTML Write a Python script that builds an HTML file of your own design.  Add an image tag into your HTML and link it to an image on your hard drive.  Make sure you store the image in the same directory as the html file, otherwise it might not find the file.

  19. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 3 Python LAB 4.14 LAB Count input length without spaces, periods, or commas For more course tutorials visit www.newtonhelp.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

  20. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 3 Python LAB 4.15 Password modifier For more course tutorials visit www.newtonhelp.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 MB becomes 8o becomes .

  21. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 3 Python LAB 4.17 Print string in reverse For more course tutorials visit www.newtonhelp.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

  22. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 3 Python LAB 4.18 Smallest and largest numbers in a list For more course tutorials visit www.newtonhelp.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:1053212-6the output is:

  23. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 3 Python LAB 4.19 Output values in a list below a user defined amount For more course tutorials visit www.newtonhelp.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:5506014020075100

  24. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 4 Python LAB 5.18 Miles to track laps For more course tutorials visit www.newtonhelp.com CYB 130 Week 4 Python LAB 5.18: Miles to track lapsOne 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.

  25. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 4 Python LAB 5.19 Driving costs – functions For more course tutorials visit www.newtonhelp.com CYB 130 Week 4 Python LAB 5.19: Driving costs - functionsDriving 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.

  26. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 4 Python LAB 5.20 Step counter For more course tutorials visit www.newtonhelp.com CYB 130 Week 4 Python LAB 5.20: Step counterA 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))

  27. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 4 Python LAB 5.21 Leap year – functions For more course tutorials visit www.newtonhelp.com CYB 130 Week 4 Python LAB 5.21: Leap year - functionsA 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

  28. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 4 Python LAB 5.22 Swapping variables For more course tutorials visit www.newtonhelp.com CYB 130 Week 4 Python LAB 5.22: Swapping variablesWrite a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is:38the 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)

  29. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 4 Python LAB 5.23 Exact change – functions For more course tutorials visit www.newtonhelp.com CYB 130 Week 4 Python LAB 5.23: Exact change - functionsWrite 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.

  30. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 4 Python LAB 5.24 Even/odd values in a list For more course tutorials visit www.newtonhelp.com CYB 130 Week 4 Python LAB 5.24: Even/odd values in a listWrite 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.

  31. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 5 Python LAB 6.5 Checker for integer string For more course tutorials visit www.newtonhelp.com CYB 130 Week 5 Python LAB 6.5: Checker for integer stringForms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. Ex: If the input is:1995

  32. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 5 Python LAB 6.6 Name format For more course tutorials visit www.newtonhelp.com CYB 130 Week 5 Python LAB 6.6: Name formatMany documents use a specific format for a person's name. Write a program whose input is:firstNamemiddleNamelastNameand whose output is:lastName, firstInitial.middleInitial.

  33. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 5 Python LAB 6.7 Palindrome For more course tutorials visit www.newtonhelp.com CYB 130 Week 5 Python LAB 6.7: PalindromeA palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome. Ex: If the input is:bobthe output is:

  34. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 5 Python LAB 6.8 Acronyms For more course tutorials visit www.newtonhelp.com CYB 130 Week 5 Python LAB 6.8: AcronymsAn acronym is a word formed from the initial letters of words in a set phrase. Write a program whose input is a phrase and whose output is an acronym of the input. If a word begins with a lower case letter, don't include that letter in the acronym. Assume there will be at least one upper case letter in the input.

  35. CYB 130 Improved tutorial / newtonhelp.com CYB 130 Week 5 Python LAB 6.24 Varied amount of input data For more course tutorials visit www.newtonhelp.com CYB 130 Week 5 Python LAB 6.24: Varied amount of input dataStatistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average and max.

  36. CYB 130 Improved tutorial / newtonhelp.com

More Related