Back-end Developer Path - Boot.Dev
Notebook
- Python is one of the most popular programming language.
- Easy to use but can also build a lot of things.
- Python looks like plain english.
- Python:
- Backend Web Development
- Automation
- Machine Learning
- DevOps
- Cloud Engineering
- Once you learn one programming language, almost all concepts you learn will apply to all programming languages, so switching technology isn't as big of a deal.
- Second programming language learning is quite easy compared to the first adn the third even easier unlike natural language.
- Python isn't known for frontend development or GUI. It's possible but isn't common.
- Syntax: The rules for how expressions and statements should be structured in a language.
- There are other errors apart from syntax errors which is bug or the code is too slow.
- Variables is how we store data as our program runs.
- Name should be descriptive and consist of a single "token" meaning continuous text with underscores separating the words.
#single line comment """ multi line comment """- Variable names must not have spaces. They're continuous strings of characters.
- It's preferred to have snake case for variable names in Python.
Name Description Code Language(s) that recommend it Snake Case All words are lowercase and separated by underscores num_new_usersPython, Ruby, Rust Camel Case Capitalize the first letter of each word except the first one numNewUsersJavaScript, Java Pascal Case Capitalize the first letter of each word NumNewUsersC#, C++ No Casing All lowercase with no separation numnewusers...just don't do this - Double quotes are preferred for strings.
- In Python, we can create strings that contain dynamic values with f-string syntax:
num_bananas = 10 bananas = f"You have {num_bananas} bananas" print(bananas) # You have 10 bananas - None Type:
- None is empty variable
Noneis a special value in Python that represents the absence of a value. It is not the same as zero, False, or, an empty string.- None Type is weird. It's special
NoneTypetype. - None can only be none.
- Idea of None is to specify there is nothing here.
- [LLM. Please Verify]Idiomatic way to check for None is via
is Noneand not== None. - None is used as a placeholder specifying nothing is here yet but there likely will be in the future.
- Use
type(variable_name)to get the type of the variable. It's useful when trying to distinguish between None type and a string that happens to be named "None". - Dynamic Typing
- Python is dynamically typed language ie.e we can change the type of the variable and Python doesn't care.
- Most scripting languages are dynamically typed: Python, JavaScript, Ruby, PHP.
- In statically write language, we can't change the variable type like in Go. Example: C, Rust, TyeScript.
- Whether it's dynamically or statically typed language, you don't want to change the variable type at all. In statically we are forced to implement this good behaviour.
- It's now safer to write statically typed language where it might not have been earlier so.
- Types used to be verbose earlier, you had to declare the type like in C, but in newer statically typed language like Go and Typescript, you don't have to specify so.
- Python is still an amazing language to learn foundational coding concepts even if it's dynamically typed. It reads like english and allows you to learn programming concepts conceptually instead of getting stuck in technicalities which can be a hurdle when starting to learn a language.
- Some really smart people still like dynamic typing.
- You can declare many variables in the same line but make sure they are related to each other in some way:
sword_name, sword_damage, sword_length = "Excalibur", 10, 200 - Clean Code: Code that's easy to understand.
The Socratic method is a form of argumentative dialogue in which an individual probes a conversation partner on a topic, using questions and clarifications, until the partner is pressed to come to a conclusion on their own, or else their reasoning breaks down and they are forced to admit ignorance.