1.1P: Preparing For OOP - Answer Sheet: Cd.. CD .
1.1P: Preparing For OOP - Answer Sheet: Cd.. CD .
the cd\ command takes you back to the root directory of the current
drive. As shown below, in the \Users\Admin directory, using the cd\
command take you to the C:\ directory.
b. ls (list): the ls command is used to list the files and directories in the
current directory (as screenshotted below)
c.
d. pwd (print working directory): the pwd command writes to standard
output the full path name of your current directory (from the root
directory) (as screenshotted below).
2. Consider the following kinds of information, and suggest the most appropriate
data type to store or represent each:
Declaring a variable sets up its type and name, while initializing a variable assigns a
value to it. Declaration is the first step, creating the variable, and initialization is the
second step, giving it an initial value.
int x : variable x is declared
x = 10 : variable x is initialized with the value 10
8.
Python :
def average():
number = int(input(“Enter a number: “))
numbers = []
while number != 0
numbers.append(number)
number = int(input(“Enter a number”))
average = sum(numbers) / len(numbers)
return average
C# :
9. In the same language, write the code you would need to call that function and
print out the result.
10. To the code from 9, add code to print the message “Double digits” if the
average is above or equal to 10. Otherwise, print the message “Single digits”.
Provide a screenshot of your program running.