0% found this document useful (0 votes)
14 views

Experiment 1: Using Software Tools and Code Versioning System

PAPER FOR CPE106L program part 1

Uploaded by

LEBRON JAMES
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Experiment 1: Using Software Tools and Code Versioning System

PAPER FOR CPE106L program part 1

Uploaded by

LEBRON JAMES
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Experiment 1: Tools and Code Versioning

Using Software
System

CPE106L (Software Design Laboratory)

Ang, Mariana Rane P.


Coronel, Jed Andro P.
Biag, John Carlo A.
Taberna, Jose Mari G.

Group No.:
Section: E011
PreLab

Readings, Insights, and Reflection

● METIS book(s)
1. Professional Git
Lasers, Brent
VBID: 9781119285007
2016

2. Chapter 1: What is Git, Git Ecosystem, Git-Hosting Sites Fundamentals of


Python: Data Structures, 2nd Edition
Kenneth Lambert
SBN-10: 0-357-12275-5
ISBN-13: 9780357122754
2019

● GitHub Docs (OneDrive):


1. Anaconda Docs
2. Git Hub Docs
● Websites:
1. Installing Anaconda:
https://docs.anaconda.com/anaconda/install/windows/
2. Introduction to Github:
https://github.com/skills/introduction-to-github

● Insights and Reflection

Professional Git

1. The first experiment serves as an introduction to the field of source code management in software
development. The process of software development is simplified using Git's straightforward
approach to source code management. Git is useful for programmers and non-technical consumers
because it monitors users' project files. Collaboration with other users allows multiple people to
work together. Git allows you to manage large projects more efficiently. GitHub allows all team
members to collaborate on projects from anywhere and simplifies interaction with each other.
GitHub provides a place for project managers and developers to organize, track, and update their
work. On GitHub, you can use pull requests to help each other review, improve, and suggest new
code.

Chapter 1: What is Git, Git Ecosystem, Git-Hosting Sites Fundamentals of Python: Data Structures, 2nd
Edition

1. Additionally, you will get an overview of Anaconda applications, a package that includes the Python
and R programming languages. For this particular experiment in the lab, we used Spyder and Visual
Studio, both written in the Python programming language. txt files located in the same folder as the
program written in Python. You will also become familiar with using the Anaconda command
prompt and try entering various commands such as ``conda info'', ``conda create'', or ``change
directory'' commands, which are ``cd'' or ``md'' to manage directories.
Visual Studio Code

1. Visual Studio Code is one example of a program we use. The Run Python File button in the top right
corner of VScode makes the application much easier to use. You also learned how to open text files
and files written in Python from folders. Additionally, you should note that Python files containing
text files must reside in a similar folder to these files. To ensure that the application works properly
and that you can access your text files, you should open the entire folder instead of opening each file
one by one.
InLab

● Objectives
1. Familiarize ourselves with GitHub by following the GitHub Lab Learning
Course “Introduction to GitHub”
2. Familiarize ourselves with Python by following the GitHub Lab Learning
Course “Introduction to Python”

● Tools Used
o Visual Studio Code
o Github

● Procedure.

Introduction to GitHub

Introduction to Github Course taught us how to Create a “branch” which said to be a parallel
version of the users Repository (Files/Folders) as seen in figure 1. In order to create a new branch, the
user would click the Main Branch drop-down that is located in the upper top left of the code tab.

Figure 1. Creating a Branch

After successfully creating a branch the user is instructed to “commit” a file, commit allows you
to enter short messages in order to inform their peers or set as a reminder to the recent
changes made in the code.
Figure 2. Creating a Commit

In figure 2 in order to Create a commit the user would need to press Add File in the code tab and click
Create New File. After Creating a Commit the user is now instructed to create a pull request. In order to
do so the user would click on the annotation statin to compare & pull request
Figure 3. Pull Request and Merge Pull Request

As seen in figure 3 after the Pull Request another annotation would pop up asking the user to Merge Pull
request, Merge Pull Request will merge the changes in the pull request and branch into the main file.
After which the Branch file can be safely deleted if the User intends to delete the branch.

Figure 4. Biag Finished Github Course

PostLab
Programming Problem 1
Statisticians would like to have a set of functions to compute the median and mode of a list
of numbers. The median is the number that would appear at the midpoint of a list if it were sorted.
The mode is the number that appears most frequently in the list. Define these functions in a
module named stats.py. Also includes a function named mean, which computes the average of a
set of numbers. Each function expects a list of numbers as an argument and returns a single
number.

Figure 1.1 Median function


In figure 1.1 the median function sorts the numbers in ascending order using sorted_numbers =
sorted(numbers). It will then determine the length of the sorted list using n = len(sorted_numbers).
After that it checks if the length is even using if n % 2 == 0.
A. If even, it will calculate the median by averaging the two middle numbers: (mid1 +
mid2) / 2.
B. If odd, it will return the middle number using return sorted_numbers[n // 2].

Figure 1.2 Mode function


Figure 1.2 shows the mode function of the program where it will import the counter class using the
import counter. It will then create a dictionary that will count the occurrences of each number from
the data using count_dict = Counter(numbers). It will then determine the maximum count using
max_count = max(count_dict.values()). After that it will filter the dictionary to find numbers with the
mximum count, then will check if theres a single mode.
a. If yes, it will return to the single mode using return mode_list[0].
b. If multiple modes, it will return None using return None.

Figure 1.3 Mean function


Figure 1.3 shows how the code will calculate the mean of the data using sum(numbers). It will divide the
sum by the number of numbers using sum(numbers) / len(numbers). It will then Returns the calculated
mean.

Figure 1.4 Calling stats.py in main.py

Figure 1.5 Sample output of the code

Programming Problem 2

Write a program that allows the user to navigate through the lines of text in a file. The program
prompts the user for a filename and inputs the lines of text into a list. The program then enters a loop in
which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers
range from 1 to the number of lines in the file. If the input is 0, the program quits. Otherwise, the program
prints the line associated with that number.

Figure 2.1. Input file name and open file.

In figure 2.1, the program asks the user to input the name of the file and its format.
It will then open the selected file and the program starts counting the lines of the
selected file shown in figure 2.2
Figure 2.2

. Furthermore, the program will ask the user to select a number line or quit and print the associated text
shown in figure 2.3. And if the input of the user is not in the range of the number lines it will prompt that it
is not available and will loop back to figure 2.5 and ask the user again to input another number

Figure 2.3

Figure 2.4

Lastly, figure 2.4 is an example of the program. In summary, the program allows the user to
select the file and number, and the program will count the number of lines in the selected file and show
the number line’s associated text, and will loop once the input is not in the range.

You might also like