Professional Documents
Culture Documents
CS50 Notes
CS50 Notes
CS50 Notes
minor details can cause bugs, which is what makes it frustrating, computers take
you literally.
return values, and variables: container for a value. Giving variables the value of
a return value.
comments, starts with # or ''' ''' can be used, a note that wont break your code.
also known as pseudocode, using human language to express your thoughts and
intentions of your code.
interactive mode, writing code in the terminal to get immediate results of the
code.
integers.
you can put a function in a function for eg, int(input("woah this is cool"))
python, just like math does the inside parenthesis first then the outer
parenthesis.
float: number with a decimal point, whereas int doesn't include decimals.
scope, variable only existing in the context in which you defined it. since.
for -
list -
_ symbol indicates a variable, which wont be used later in the program, irrelevant
break - will break out of the most recently begun while loop, when the condition is
true of course.
while True:
x = int(input("whats x "))
if x > 0:
break
above code can be used to repeatedly ask for input if the user doesn't provide
certain input.
dict, data structure that allows you to associate one value with another. Just
like a dictionary in the real world.
for loop