Python Basics

python
coding
introduction
Author

Bryan Armpriest

Published

February 14, 2025

A Brief Introduction to Python: a Summary of Week 2 and 3

First, we took time to learn about variables, operators, and converting from one kind of variable to another. In the example below, I converted x that contained an integer into one that contained a float.

#You can assign a variable like this:
x = 10
#You can interact with variables, call them back, and use them in different ways!
x*4
x/2.25

#
type(x)
float(x)
10.0

Another major topic that we covered were while and for loops.

#while loops can be used to take a monotonous task and automate it

count = 1
while count <= 5:
    print(count)
    count += 1

#for loops can also be very useful! However, it can be tricky as well when thinking about what to iterate
for i in "count":
  print(i)
1
2
3
4
5
c
o
u
n
t

We also learned about many other functions that are important through Python that would simply take too much time to list every single one. The main ones that come to mind are dictionaries, lists, dataframes, functions, break/continue in the for/while loops, and so many more!

Thank you for reading!