Experiment 1: Using Software Tools and Code Versioning System
Experiment 1: Using Software Tools and Code Versioning System
Using Software
System
Group No.:
Section: E011
PreLab
● METIS book(s)
1. Professional Git
Lasers, Brent
VBID: 9781119285007
2016
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.
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.
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.
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.
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.