CP30681E: Intro to Software Development Log Book - UWL, Computing
VerifiedAdded on 2023/06/15
|41
|6553
|184
Homework Assignment
AI Summary
This document is a log book for the Introduction to Software Development module (CP30681E) at the University of West London. It covers topics such as code repositories, software layers, algorithms, and Python programming. The log book includes practical exercises involving Python, covering basic syntax, data types, operators, and error handling. Tasks include writing algorithms, debugging code, and implementing mathematical functions. The document also touches upon the importance of variable naming conventions and provides examples of compile-time and run-time errors in Python. The student also demonstrates using Github for version control and code management. Desklib is a website where students can find similar assignments and study resources.

INTRODUCTION TO SOFTWARE DEVELOPMENT
MODULE CODE: CP30681E
LOG BOOK
STUDENT ID: XXXXXXXXXXX
SCHOOL OF COMPUTING AND ENGINEERING
UNIVERSITY OF WEST LONDON
MODULE CODE: CP30681E
LOG BOOK
STUDENT ID: XXXXXXXXXXX
SCHOOL OF COMPUTING AND ENGINEERING
UNIVERSITY OF WEST LONDON
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

ISD lab sheet week 1
In the first week, we learnt about the various uses of a code repository and other
programming tools. We were also introduced to various software and hardware modules, different
application layers and some crucial programming languages.
Questions:
1. What is a code repository (often also called version control system) used for?
Ans. A code repository is a virtual location where one can store his or her codes and
documentations for various programs or applications. A general repository tool or software
provides the techniques to add and maintain several versions of a program, while it still is in its
development stage. One can easily keep track of the changes that have been made over time.
Here, the online code-repository Github has been used to manage the coding tasks for the
assignment and learn a handful from them.
2. Why is it advantageous to use a code repository?
Ans. The advantages of using code repositories are:
i) It enables the collaboration of various team members to work together in a
project, by communicating easily. This allows the different members to download
the modifications or advancements made to the codes and proceed accordingly.
ii) It helps to backup and restore projects.
iii) As it helps to keep track of all the versions of a project throughout its
development phase, one can easily get back codes from the past and use
accordingly.
iv) The documentation feature helps a lot in the understanding of the projects that
are stored there.
3. Describe the different “layers” of Software that exist on a typical computer and explain why
there are different layers of software.
Ans. The different layers of software, which exist in a typical computer, are System Software
and Application software. The application software level helps the program or software to
interact with the user. The user can put in inputs, view instructions and get output on the
application layer of a software. Whereas, the system layer helps the application layer to
In the first week, we learnt about the various uses of a code repository and other
programming tools. We were also introduced to various software and hardware modules, different
application layers and some crucial programming languages.
Questions:
1. What is a code repository (often also called version control system) used for?
Ans. A code repository is a virtual location where one can store his or her codes and
documentations for various programs or applications. A general repository tool or software
provides the techniques to add and maintain several versions of a program, while it still is in its
development stage. One can easily keep track of the changes that have been made over time.
Here, the online code-repository Github has been used to manage the coding tasks for the
assignment and learn a handful from them.
2. Why is it advantageous to use a code repository?
Ans. The advantages of using code repositories are:
i) It enables the collaboration of various team members to work together in a
project, by communicating easily. This allows the different members to download
the modifications or advancements made to the codes and proceed accordingly.
ii) It helps to backup and restore projects.
iii) As it helps to keep track of all the versions of a project throughout its
development phase, one can easily get back codes from the past and use
accordingly.
iv) The documentation feature helps a lot in the understanding of the projects that
are stored there.
3. Describe the different “layers” of Software that exist on a typical computer and explain why
there are different layers of software.
Ans. The different layers of software, which exist in a typical computer, are System Software
and Application software. The application software level helps the program or software to
interact with the user. The user can put in inputs, view instructions and get output on the
application layer of a software. Whereas, the system layer helps the application layer to

communicate with the hardware. It converts the user’s inputs in the application layer into
machine language and helps the hardware components to compute them. Further, after
computation this data is changed to user readable language and is communicated back to the
application layer as output.
4. Describe what an algorithm is and explain why it is a useful “tool” to translate from a
human level problem (we can think of) to a computer program.
Ans. Algorithm can be defined as a useful technique that can be used to write down the logic
behind the programs in the write order. It lists the correct order of the instructions or steps
that are to be followed by any program in order to produce the desired output. These are
generally written in plain English language or pseudo codes or via flow-chart diagrams.
It is easier to understand. Novice programmers or people who have no knowledge of
programming can easily understand the logics and instructions behind the execution of the
programs.
machine language and helps the hardware components to compute them. Further, after
computation this data is changed to user readable language and is communicated back to the
application layer as output.
4. Describe what an algorithm is and explain why it is a useful “tool” to translate from a
human level problem (we can think of) to a computer program.
Ans. Algorithm can be defined as a useful technique that can be used to write down the logic
behind the programs in the write order. It lists the correct order of the instructions or steps
that are to be followed by any program in order to produce the desired output. These are
generally written in plain English language or pseudo codes or via flow-chart diagrams.
It is easier to understand. Novice programmers or people who have no knowledge of
programming can easily understand the logics and instructions behind the execution of the
programs.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

WEEK 2 - PRACTICAL SESSION 2
In week-2, we were taught about the details of computer programming. We came to know
about the keywords, identifiers, variables, operators and syntaxes that enrich any programming
language and helps in performing the desired operations. We were also taught about high-level
programming languages are converted into machine codes for the computer to understand. Then
we learnt about algorithms, their uses and importance in the field of software development.
Compilers and interpreters were among the other new topics that were taught to us. Then we were
introduced to the basics of the PYTHON language, its history, and language shell that is called as
IDLE.
Finally, we were taught about the various PYTHON keywords the correct ways to implement
each in order to solve regular coding problems.
TASKS:
1) Write an algorithm that describes how to make scrambled eggs, try to use control
words, like IF, WHEN, UNTIL, WHILE, WAIT, AND, OR.
Ans. :
1. Take a few number of eggs.
2. Break them and then pour them in a bowl.
3. Put in some black pepper and salt.
4. Batter the egg yolk for a minute inside the bowl until it becomes fluffy.
5. Now, take a clean frying pan.
6. Put oil in it.
7. Heat the pan.
8. Wait for the oil to get heated up.
9. Put the battered egg into the pan
10.While egg is not cooked,
a. stir the eggs slowly in the frying pan
b. End while
11.If any other ingredients are needed
a. Add other ingredients like red chillies, cheese etc.
12.End if
13. Put the scrambled egg in a plate and serve.
2) Is Idle (the Python language shell) an Interpreter or an Compiler or both? Explain
your answer.
Ans. Python’s language shell – IDLE is an interpreter. It takes one command or
instruction at a time, execute it, and retreats to the Development Environment in
In week-2, we were taught about the details of computer programming. We came to know
about the keywords, identifiers, variables, operators and syntaxes that enrich any programming
language and helps in performing the desired operations. We were also taught about high-level
programming languages are converted into machine codes for the computer to understand. Then
we learnt about algorithms, their uses and importance in the field of software development.
Compilers and interpreters were among the other new topics that were taught to us. Then we were
introduced to the basics of the PYTHON language, its history, and language shell that is called as
IDLE.
Finally, we were taught about the various PYTHON keywords the correct ways to implement
each in order to solve regular coding problems.
TASKS:
1) Write an algorithm that describes how to make scrambled eggs, try to use control
words, like IF, WHEN, UNTIL, WHILE, WAIT, AND, OR.
Ans. :
1. Take a few number of eggs.
2. Break them and then pour them in a bowl.
3. Put in some black pepper and salt.
4. Batter the egg yolk for a minute inside the bowl until it becomes fluffy.
5. Now, take a clean frying pan.
6. Put oil in it.
7. Heat the pan.
8. Wait for the oil to get heated up.
9. Put the battered egg into the pan
10.While egg is not cooked,
a. stir the eggs slowly in the frying pan
b. End while
11.If any other ingredients are needed
a. Add other ingredients like red chillies, cheese etc.
12.End if
13. Put the scrambled egg in a plate and serve.
2) Is Idle (the Python language shell) an Interpreter or an Compiler or both? Explain
your answer.
Ans. Python’s language shell – IDLE is an interpreter. It takes one command or
instruction at a time, execute it, and retreats to the Development Environment in
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

case any error is come across in any of the line. It waits to produce further
compilation report till the earlier error is solved.
3) Write a command in the Idle shell that says “Hello world”
4) Write a program that produces the following output:
Hello World
I am in my ISD class right now
Ans.
Program :
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
print("Hello World") # print command display output on screen
print("I am in my ISD class right now")
compilation report till the earlier error is solved.
3) Write a command in the Idle shell that says “Hello world”
4) Write a program that produces the following output:
Hello World
I am in my ISD class right now
Ans.
Program :
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
print("Hello World") # print command display output on screen
print("I am in my ISD class right now")

5) Write a program that asks the user for his/her name and produces an output
like:
Hi there, what is your name?
>User input to be read<
Hello
“User name”
How are you?
Ans. :
PROGRAM :
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
name = input("Hi there, what is your name? ") #input takes input from the keyboard
print("Hello")
print(name)
print("How are you?")
like:
Hi there, what is your name?
>User input to be read<
Hello
“User name”
How are you?
Ans. :
PROGRAM :
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
name = input("Hi there, what is your name? ") #input takes input from the keyboard
print("Hello")
print(name)
print("How are you?")
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

WEEK 3 – PRACTICAL SESSION 3
This week we learnt about the basics of the Python language. We learnt how to use # or hash to
write a single line comment. Then, we were taught to write programs, save them, compile them,
debug the errors and finally execute the programs.
Next we learnt about variable, data types of variable in python and how to convert values to
different data types using type casting commands like int(), float(), str().
Finally we learnt to create account the github.com website and upload programs in it.
TASKS:
1) Write a program that asks for two numbers (Python has all the basic
mathematical functions in place, like +,- etc.), adds them up and displays the
result.
Ans.:
PROGRAM:
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
number1 = int(input("Enter First number: "))
number2 = int(input("Enter Second number: "))
sum = number1 + number2
print("The sum = ", sum)
This week we learnt about the basics of the Python language. We learnt how to use # or hash to
write a single line comment. Then, we were taught to write programs, save them, compile them,
debug the errors and finally execute the programs.
Next we learnt about variable, data types of variable in python and how to convert values to
different data types using type casting commands like int(), float(), str().
Finally we learnt to create account the github.com website and upload programs in it.
TASKS:
1) Write a program that asks for two numbers (Python has all the basic
mathematical functions in place, like +,- etc.), adds them up and displays the
result.
Ans.:
PROGRAM:
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
number1 = int(input("Enter First number: "))
number2 = int(input("Enter Second number: "))
sum = number1 + number2
print("The sum = ", sum)
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

2) Answer the questions by implementing the code and run it.
a) What will the output be from the following code?
num = 4
num*=2
num1=num+2
num1+=3
print(num1)
Ans. Output: 13
b) What do the following lines of code output? Why do they give a different
answer?
print(2 / 3)
print(2 // 3)
Ans.:
0.6666666666666666
0
‘/’ does normal division by producing results in decimal values.
‘//’ does integer division only and therefore returns the floor value of the divided result.
3) All of the variable names below can be used. But which of these is the better
variable name to use?
A a Area AREA area areaOfRectangle AreaOfRectangle
Ans. areaOfRectangle is the best option to use as it uses the valid camel case variable
naming notation. Further, it conveyes the entire task that the variable is ought to
perform.
4) Which of these variables names are not allowed in Python? (More than one might
be wrong.)
apple APPLE Apple2 1Apple account number account_number
account.number accountNumber fred Fred return return_value
5Return GreatBigVariable greatBigVariable great_big_variable
great.big.variable
a) What will the output be from the following code?
num = 4
num*=2
num1=num+2
num1+=3
print(num1)
Ans. Output: 13
b) What do the following lines of code output? Why do they give a different
answer?
print(2 / 3)
print(2 // 3)
Ans.:
0.6666666666666666
0
‘/’ does normal division by producing results in decimal values.
‘//’ does integer division only and therefore returns the floor value of the divided result.
3) All of the variable names below can be used. But which of these is the better
variable name to use?
A a Area AREA area areaOfRectangle AreaOfRectangle
Ans. areaOfRectangle is the best option to use as it uses the valid camel case variable
naming notation. Further, it conveyes the entire task that the variable is ought to
perform.
4) Which of these variables names are not allowed in Python? (More than one might
be wrong.)
apple APPLE Apple2 1Apple account number account_number
account.number accountNumber fred Fred return return_value
5Return GreatBigVariable greatBigVariable great_big_variable
great.big.variable

Ans. 1Apple, account number, account.number, return, 5Return and great.big.variable are the
names that are not allowed to be used as variable names in Python.
WEEK 4 – PRACTICAL SESSION 4
In the 4th week, we were taught about the use of python’s various keywords, variable
declarations, data types and type casting methods or conventions. We also learnt about the
operator precision through the use of logical, mathematical and bit-wise operators. ). Further, we
also learnt the use of escape sequence characters to get formatted output. String concatenation
and repeating characters were also introduced. Finally, we learnt in details the various types of
errors that exist in python programming, such as syntax errors, runtime errors and logical errors.
TASK:
1. Explain the mistake in the following code:
radius = input("Radius:")
x = 3.14
pi = x
area = pi * radius ** 2
Ans. : The input command returns a string version of the user’s input. Therefore, when
trying to perform the multiplication with a float value in area = pi * radius ** 2 there will be
a mismatch of datatypes and the operations will not take place, instead an error will be
posted.
2. Explain the mistake in the following code:
x = 4
y = 5
a = 3(x + y)
Ans.: a = 3(x + y) will produce an error. This might be a correct mathematical operation but in case
of Python programming, the ‘*’ operator must be used to instruct the multiplication operation.
There it must be: 3*(x+y)
3. Explain the mistake in the following code:
radius = input(float("Enter the radius:"))
Ans. Here the position of input and float is a mistake. Float cannot be used to typecast direct string
messages. It should be: radius = float(input(“Enter the radius : “))
names that are not allowed to be used as variable names in Python.
WEEK 4 – PRACTICAL SESSION 4
In the 4th week, we were taught about the use of python’s various keywords, variable
declarations, data types and type casting methods or conventions. We also learnt about the
operator precision through the use of logical, mathematical and bit-wise operators. ). Further, we
also learnt the use of escape sequence characters to get formatted output. String concatenation
and repeating characters were also introduced. Finally, we learnt in details the various types of
errors that exist in python programming, such as syntax errors, runtime errors and logical errors.
TASK:
1. Explain the mistake in the following code:
radius = input("Radius:")
x = 3.14
pi = x
area = pi * radius ** 2
Ans. : The input command returns a string version of the user’s input. Therefore, when
trying to perform the multiplication with a float value in area = pi * radius ** 2 there will be
a mismatch of datatypes and the operations will not take place, instead an error will be
posted.
2. Explain the mistake in the following code:
x = 4
y = 5
a = 3(x + y)
Ans.: a = 3(x + y) will produce an error. This might be a correct mathematical operation but in case
of Python programming, the ‘*’ operator must be used to instruct the multiplication operation.
There it must be: 3*(x+y)
3. Explain the mistake in the following code:
radius = input(float("Enter the radius:"))
Ans. Here the position of input and float is a mistake. Float cannot be used to typecast direct string
messages. It should be: radius = float(input(“Enter the radius : “))
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

4. Why does this code not calculate the average?
print(3 + 4 + 5 / 3)
Ans. The above code defies the proper use of operator precedence. The code will divide 5 by 3 and
add 3 and 4 to its result. There must be brackets to couple the addition part to be divided solely by
3, i.e., (3 + 4 + 5 )/ 3.
5. Consider the following code:
x = 19.93
y = 20.00
z = y – x
print(z)
The output is 0.0700000000028 Why is that so?
Improve the code so that the output is to two decimal places.
Ans. : Both x and y are float datatype variables. Thus, the output is a float type value with
complete precision of 13 digits.
To have the output in two decimal places : print (“%.2f”, %z)
6. Find at least three compile-time errors:
int x = 2
Print (x, squared is, x * x)
xcubed = x *** 3
Ans.:
1. int cannot be written to declare a variable. This would return an Invalid Syntax error.
2. Print must not be in caps. It should be print()
3. Inside the print statement, the message ‘squared is’ is kept in the open. The program
will not recognize it as a variable. It should be put in “ “.
4. *** is an invalid use of operators.
7. Find two run-time errors:
from math import sqrt
X = 2
Y = 4
print(“The product of “, x, “and”, y, “is”, x + y)
print(“The root of their difference is “, sqrt(x – y))
print(3 + 4 + 5 / 3)
Ans. The above code defies the proper use of operator precedence. The code will divide 5 by 3 and
add 3 and 4 to its result. There must be brackets to couple the addition part to be divided solely by
3, i.e., (3 + 4 + 5 )/ 3.
5. Consider the following code:
x = 19.93
y = 20.00
z = y – x
print(z)
The output is 0.0700000000028 Why is that so?
Improve the code so that the output is to two decimal places.
Ans. : Both x and y are float datatype variables. Thus, the output is a float type value with
complete precision of 13 digits.
To have the output in two decimal places : print (“%.2f”, %z)
6. Find at least three compile-time errors:
int x = 2
Print (x, squared is, x * x)
xcubed = x *** 3
Ans.:
1. int cannot be written to declare a variable. This would return an Invalid Syntax error.
2. Print must not be in caps. It should be print()
3. Inside the print statement, the message ‘squared is’ is kept in the open. The program
will not recognize it as a variable. It should be put in “ “.
4. *** is an invalid use of operators.
7. Find two run-time errors:
from math import sqrt
X = 2
Y = 4
print(“The product of “, x, “and”, y, “is”, x + y)
print(“The root of their difference is “, sqrt(x – y))
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Ans.:
1. In the first print statement promises to print the same of x and y, instead prints the
product.
2. The second print statement tries to find the square root of a negative number, as x<y.
8. Write statements to prompt user for their name and age
Write a print statement to output:
Hello ____, next year you will be ____ years old!
Ans. :
Program :
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
name = input("Enter your name: ")
age = int(input("Enter your age: "))
print("Hello ", name, ", next year you will be ", age+1, " years old!")
1. In the first print statement promises to print the same of x and y, instead prints the
product.
2. The second print statement tries to find the square root of a negative number, as x<y.
8. Write statements to prompt user for their name and age
Write a print statement to output:
Hello ____, next year you will be ____ years old!
Ans. :
Program :
# -*- coding: utf-8 -*-
"""
Created on
@author:
"""
name = input("Enter your name: ")
age = int(input("Enter your age: "))
print("Hello ", name, ", next year you will be ", age+1, " years old!")

9. Given that radius is 2 and area is calculated as 12.5678, use string format operators to print
the values of the variables radius and area so that the output looks like this:
Radius is: 2
Area is: 12.57
Ans.:
print(“Radius is: \t %d”, 2)
print(“ Area is: \t %.2f”, 12.5678)
10. What are the values of the following expressions, assuming that p is 17 and q is 18?
i. p // 10 + p % 10
Ans. 17 // 10 + 17 % 10 = 8
ii. p % 2 + q % 2
Ans. 17 % 2 + 18 % 2 = 1
iii. (p + q) // 2
Ans. (17 + 18) // 2 = 17
iv. (p + q) / 2.0
Ans. (17 + 18) / 2.0 = 17.5
the values of the variables radius and area so that the output looks like this:
Radius is: 2
Area is: 12.57
Ans.:
print(“Radius is: \t %d”, 2)
print(“ Area is: \t %.2f”, 12.5678)
10. What are the values of the following expressions, assuming that p is 17 and q is 18?
i. p // 10 + p % 10
Ans. 17 // 10 + 17 % 10 = 8
ii. p % 2 + q % 2
Ans. 17 % 2 + 18 % 2 = 1
iii. (p + q) // 2
Ans. (17 + 18) // 2 = 17
iv. (p + q) / 2.0
Ans. (17 + 18) / 2.0 = 17.5
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 41
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.