Complete Python Developer in 2021: Zero to Mastery download code example

Example 1: complete python developer in 2020 zero to mastery

# Note: No semicolons needed. Comments: #
# Tips: \n in string adds new line. \t adds new tab. len() measures length of item. int(), str(), float(), bool, etc converts items
# Output: print(value)
print("Hi!")
# Variables
my_variable = "Hi!" # Strings
my_second_var = 1.2 # FLoats
third = 3 # Integers
fourth = True # Bools: True, False
# String/Int/Float Combination
third = 3 + 2
my_variable = "Hi " + "Jerry!"

#Input: input(value)
name = input("What is your name? ")
print(f"You said your name was {name}") # F - Strings: F at beginning, {variable name +- any other things} to add in a variable
# Operators: +, -, *, /, **(exponent), %(remainder)
# Checking Operators: ==(Equals to), >, <, <= (Less than/Equal to), >= (Bigger than/Equal to)
# Other cheking operators: and, or, is, in
# If statements
word = input("Enter a random word\n")
#.  \/ Converts word to lowercase. .upper() to uppercase, .title() to capitalized
if word.lower() == "force":
  print("You chose `force` as I predicted!")
 # Elif, or else if statements
elif word.lower() == "python":
  print("HahaYes, you chose `python`")
# Else
else:
  print(f"I did not predict your choice, which was {word}")
# Loops
# while Loops
counter = 1
while counter <= 20: # Until Counter is 21
  print(f"The counter is: {counter}")
  counter += 1 # Increments counter
# for Loops
for counter2 in range(1, 20): # Loops counter2 from 1 to 20
  print(f"The counter is: {counter2}")
  # Increment not needed!
# Lists
food = ['chicken', 'donut', 'potato']
print(food[0]) # 0 is first index, so prints `chicken`
print(food[-1]) # -1 is last index, so prints `potato`
print(food[1]) # Second index: `donut`
# Adding to end of list using .append() method
food.append("salad")
# Deleting items from list
del food[-1]
# Inserting into list
food.insert(0, "bread") # .insert(index, item)
# Lastly, updating:
food[0] = "pizza"
# List for loops:
for item in food: # Iterates through list
  print(item)

# Lastly, Functions
def display(value): #Defines function display() with parameter `value`
  print(value)
  return 0

# If we try this:
display("Functions rock!")
# We get: `Functions rock!`
# But if we do this:
final_variable = display("Functions rock!") # We get that and a varoiable that holds 0, because the functions returns 0

Example 2: complete python developer in 2020 zero to mastery

# Do what you want, Google if you don't know how to.