3. 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
4. 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
5. 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.
.....................................................................................................................
.........................................
6. 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
7. 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
8. 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.
10. 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
11. 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).
12. 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
13. 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.
14. 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.
15. 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.
16. .............................................................................................
.................................................................
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))
17. 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
18. 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))
19. 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.
20. 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.
21. 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
22. 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.
23. 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
24. 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
25. 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
26. 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
27. 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 !
28. 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.
30. 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
31. 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
32. 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.
33. 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.
34. 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.
.....................................................................................................................
.........................................
35. 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:
36. 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
37. 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
38. 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)
39. 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))
40. 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
41. 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.
42. 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
43. 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
44. 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
45. 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.
.....................................................................................................................
.........................................
46. 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
47. 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:
48. 5
1
2
3
4
5
the output is:
not even or odd
Your program must define and call the following two functions.
is_list_even() returns true if all integers in the list are even and false
otherwise. is_list_odd() returns true if all integers in the list are odd and
false otherwise.
def is_list_even(my_list)
def is_list_odd(my_list)
.....................................................................................................................
.........................................
CYB 130 Week 5 Discussion Handling Errors
49. For more course tutorials visit
www.tutorialrank.com
Respond to the following in a minimum of 175 words:
It is important to program your code efficiently. Efficient code manages
errors and exceptions and cleans up memory after it ends. The try-except
statements are helpful in handling errors that are detected during
execution. What are the two categories of errors when debugging code?
How can the try-except statements handle errors in Python? Provide a
code example that supports your comments.
.....................................................................................................................
.........................................
CYB 130 Week 5 Python LAB 6.5 Checker for integer
string
For more course tutorials visit
www.tutorialrank.com
CYB 130 Week 5 Python LAB 6.5: Checker for integer string
Forms 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.
50. Ex: If the input is:
1995
the output is:
yes
Ex: If the input is:
42,000
or any string with a non-integer character, the output is:
no