programming fundamentals Flashcards
what is a sequence?
the specific order in which instructions are performed in an algorithm
what is a selection?
the process of making a decision eg a if statement
what is an iteration?
times when a program. needs to repeat certain steps until told otherwise, or until a condition has been me eg a loop.
what is MOD ?
% is the remainder when dividing
what is DIV?
// divides numbers to the nearest whole number. ignores remainders.
what is casting?
changing a data type. int()
what is concatenation?
obtaining a new string that contains both of the original strings. input()
what is slicing
the extraction of a part of a string or list
how to do file handling?
file= open(“file.txt”,”a”)
file.write(“what you want to write”)
file.close()
how to do random number generation?
random. randint(a, b)
how to find a random letter in a word?
fruit=”apple”
print(fruit[1])