What does cd stand for?
change directory
What is a list method?
A function that can be used on lists
prints 0, 12, 24, 36, 48, 60, 72
I want to create a program that adds two ages. Here is my attempt:
What should this print out if I input age1 for 10 and age2 for 5?
"105"
The error is age1 and age2 were never converted to integers!
What does this program print if the user inputs 125 for price and 10 (as a percent) for tax?
137.5
What does the command code do?
open a file
What is a string in terms of a list?
A string is a list of characters
prints 200, 180, 160, 140, 120, 100
I want to print out every element in the list. Will this program do that? Why or why not?
This program will print out every element in the list other than the first one. Indices start at 0 not 1!
What is printed out from this program?
[4,2,3]
mkdir is used for.
make directory/folder
What happens in the following line:
print(name[-8])
IndexErrror: Out of Range
When should a while loop be used over a for loop and vice versa?
A while loop should be used when you don't know how long the loop is run or you want to stop at a certain condition. A for loop should be used when you know exactly how many times the loop should run.
What does this program print out? I'm trying to find print the numbers between 10 and 200.
The program prints 10. You should check that x > 200 instead of x < 200.
What does this program do?
How does one move back one directory/folder in the terminal?
lst = [[5,7,8], [9, 12, 5], [6, 7, 8]]
What is the result of the program below:
5 7 8
9 12 5
6 7 8
123
456
789
I'm trying to return the sum of the digits in a number. What should this program return if I input the 575.
It will give a list is not subscriptable error. Integers are not iterable where we can use a for loop to go through each digit. You would need to either convert the number to a list of digits or a string!
What list does this program print out?
[8, 10, 3, 8, 6, 14, 10, -10, 3, 4, 'hello', 'JaydenJayden']
[20, 5, 7, 8, 12, -5, "hello", "Jayden", True, False, "Alyssa"]
What value does this function return when string = "abc"
6
What should this function return if I call search(2, [5,6,7,2])
It'll return an error. We should check if "value in list" instead of "list in value"
What does this function do?