Skip to content

Latest commit

 

History

History
185 lines (136 loc) · 7.28 KB

README.md

File metadata and controls

185 lines (136 loc) · 7.28 KB

Hello 👋, I'm Kyle

Written in:
Written in Python

These are the scripts that I created while in my Python class (IT-140) at SNHU.

If you have found these to be helpful, please consider sponsoring my work or donating.

All Challenge Activities and Labs are from the zyBooks program. The Class Assignments are what is turned in via online learning system.

Scripts

Chapter 1 Labs

Lab 1.9
Asks the user for 4 inputs. Then outputs a short story using those 4 inputs.

Lab 1.10
Asks the user for an integer. Then outputs the users input, then outputs it squared, then cubed. Asks the user for another integer and takes both integers and finds the sum and product. Outputs the sum and product.

Lab 1.21
Uses integers inputted by user and assigns them to variables user_num and x, then outputs user_num divided by x 3 times.

Lab 1.22
Uses inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Outputs the average calories burned for a person given those inputs. Then uses the floating-point value to show two digits after the decimal point.

Lab 1.23
Prompts the user to input an integer between 32 and 126, a float, a character, and a string, storing each into separate variables. Then, outputs those four values on a single line separated by a space. Then outputs those variables in reverse order. Then converts the integer into a character and outputs the character.

Chapter 2 Labs

Lab 2.12
Prompts the user to input their full name (ex Kyle William Reddoch). Outputs the name in format (Reddoch, K.W.) if middle name is present, if not present, then outputs in format (Reddoch, K.).

Lab 2.13
Prompts user for input (ex. h Monday). Then outputs how many "h" are in the second phrase (Monday).

Lab 2.14
Prompts users to input favorite color, flower, and number. Creates 2 password combos using the inputs. Then calculates how many characters in each password.

Chapter 3 Labs

Lab 3.11
Prompts the user to input 3 numbers. Converts those numbers to integers. Then finds the smallest of those numbers.

Lab 3.12
Prompts user to input at date (ex. May 5). Determines the season of the date inputted.

Lab 3.13
Prompts users to input a total change amount as integer (ex. 150 for $1.50). Then outputs how many of the following is needed: Dollars, Quarters, Dimes, Nickels, and Pennies.

Chapter 4 Labs

Lab 4.14
Given a line of text as input, count the input length and output the number of characters excluding spaces, periods, or commas.

Lab 4.15
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 .

Lab 4.16
This program will output a right triangle based on user specified height triangle_height and symbol triangle_char.

(1) The given program outputs a fixed-height triangle using a * character. Modify the given program to output a right triangle that instead uses the user-specified triangle_char character.

(2) Modify the program to use a loop to output a right triangle of height triangle_height. The first line will have one user-specified character, such as % or *. Each subsequent line will have one additional user-specified character until the number in the triangle's base reaches triangle_height. Output a space after each user-specified character, including a line's last user-specified character.

Lab 4.17
This program takes a string and an integer as input, and outputs a sentence using the input values as shown in the example below. The program repeats until the input string is quit and disregards the integer input that follows.

Chapter 5 Labs

Lab 5.18
Program asks user to input two integers and then outputs the two integers swapped.

Lab 5.19
Similar to the exact change script from earlier lab but this time you create a function and then return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.

Chapter 6 Labs

Lab 6.12
Program takes any number of integers as input, and outputs the average and max.

Lab 6.13
Program gets a list of integers from input, and outputs non-negative integers in ascending order (lowest to highest).

Lab 6.18
Program that reads a list of words. Then, outputs those words and their frequencies.

Lab 6.19
Program that replaces words in a sentence. The input begins with word replacement pairs (original and replacement). The next line of input is the sentence where any word on the original list is replaced.

Chapter 7 Labs

Lab 7.8
Program first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Then outputs the words and their frequencies (the number of times each word appears in the file) without any duplicates.

Lab 7.9
Program first reads in the name of an input file and then reads the input file using the file.readlines() method. The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Then puts the contents of the input file into a dictionary where the number of seasons are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons).

Then sorts the dictionary by key (least to greatest) and outputs the results to a file named output_keys.txt, separating multiple TV shows associated with the same key with a semicolon (;). Next, sorts the dictionary by values (alphabetical order), and outputs the results to a file named output_titles.txt.

Chapter 8 Labs

Lab 8.9
In this lab, you will complete the Car class by creating an attribute purchase_price (type int) and the method print_info() that outputs the car's information.

Lab 8.10
In this lab, you will complete the Team class implementation.

Class Assignments

NameAge.py
Prompts the user for their name and age. Then outputs what year they were born. (For this assignment, it didn't require us to check to see if the user already had a birthday or not)

PrintCentury.py
Prompts the user for a year. Then outputs whether that year was the 20th century, 21st century, Distant future, or Long ago.

ModuleSixAssignment.py
This is the code written for moving between rooms for the text-based game project that will be coded for the class.

TextBasedGame.py
Space Attack - the text-based game I wrote in Python for the class project. You can also find it at its own repository at https://github.com/kylereddoch/SpaceAttack.

Extras

Higher_Lower_Game.py
This goes along with Module 4 assignment. It is not part of the assignment though. I just created it to help walk myself through the pseudocode.