Vibrant scenery at Joshua Tree National Park.

100 Days of Python: Day 5

Dictionaries Are: mutable keys must be hashable this meaning functions can actually be keys have fun methods like pop() and popitem() for removing keys support nesting don’t support nested membership tests 1 2 3 4 5 f = {1: 'value', len: 1, 'str': (1j-3) } self.assertEqual(f[1], 'value') self.assertEqual(type(f[1]), str ) self.assertEqual(type(f[len]), int ) self.assertEqual(type(f['str']), complex ) Sets Oh. boy. First class support for sets 🤩 wow, I’m so excited!...

February 25, 2021 · 2 min · Alan Scherger
Snow covered ground with white air balloons hovering

100 Days of Python: Day 4

Booleans We started the morning off with this article. True and False are also integers 1 and 0: 1 2 True == 1 False == 0 This means that can be used to count things with sum(). Python uses shortcutting when evaluating logical expressions, so if it already knows the answer, the other statements will never be executed. The is operator validates the identity of an object....

February 23, 2021 · 3 min · Alan Scherger
Homes off in the distance covered in snow.

100 Days of Python: Day 3

String slices Slices of string includes the first value and excludes the last value. Negative indexing works as well, but you still cannot “wrap around” the slice more than once. Striding allows you to skip values in an array, and negative striding lets you start at the end of the string and work backwards. Strings are immutable in Python, so you need to use slices of replace() to change them....

February 22, 2021 · 2 min · Alan Scherger
Two icicles melting

100 Days of Python: Day 2

Data Types Continued Today we start off by continuing to learn about Data Types! Most of the rest of this actually isn’t helpful, but I got to play with some built-in functions like abs() and divmod() which was kinda fun. Variables in Python Variable Assignment Python uses the same basic assignment operations that most programming languages. 1 2 3 n = 300 print(n) # 300 Types are fluid though, so you can re-assign n to n = "hello" and life goes on....

February 21, 2021 · 3 min · Alan Scherger
Child starring at large set of steps.

100 Days of Python: Day 1

Real Python We’re going to start off this series by going through whatever fancies me on Real Python. Their Introduction to Python seems like a reasonable place to start, so off we go. Repl.it We can start sharing and playing with code instantly with repl.it. IDLE 3 Interacting With Python IDLE It turns out IDLE is an IDE for Python is perhaps usually installed with most distributions by default, so I figure I’d kick the tires on it....

February 19, 2021 · 3 min · Alan Scherger