A pattern-matching side quest whilst completing this year's advent of code. Learn how to pattern match complex structures such as iterators in Python: https://lnkd.in/ew3Bw5Vk
Jamie Chang’s Post
More Relevant Posts
-
Python has two ways of passing arguments to a function: positional arguments (which every language has) and keyword arguments (somewhat rarer). Have you ever thought about when you would want to use one or the other? Before you think that it probably doesn't matter, consider that python has ways for the function designer to restrict how arguments are passed - just try running len(obj=123) and see what result you get. So, does it really matter which way I pass the arguments? Why would the language have features to restrict which kind of argument should be passed? Answers for all these questions are in the latest deep dive article on Playful Python - https://lnkd.in/gJkFvA24
To view or add a comment, sign in
-
-
🌟 Level 1: The Adventure Begins with Variables! 🎒🐍 🔑 What is a Variable? Imagine you have a bag in which you can store different items like numbers, words, or even more complex things. In Python, this bag is called a variable. Think of it as a way to carry and store important information for your adventure! For example, let’s say you collect gold coins during your journey. In Python, you would store that treasure like this: gold_coins = 100 Here, the gold_coins(bag) holds the value 100. You can open it anytime and see what’s inside by using Python’s magic spell: print(). print(gold_coins) # This will show the value inside your bag: 100 🧑💻 Backend Insight: When you assign gold_coins = 100, Python stores the value 100 in memory under the name gold_coins. Every time you call for it, Python knows exactly where to find that treasure!
To view or add a comment, sign in
-
Woof, that was tough! Although I had experience with Python, this time, I had to travel a lot further into Python by experimenting with different libraries, like PySimpleGUI, Streamlit, Pandas, FPDF, Selectorlib, PyQt6, Django, SQLAlchemy, NLTK, and image processing. It took way more to complete all the exercises, understand, and document for better remembering. Moving forward! https://lnkd.in/dK6YBnZR
To view or add a comment, sign in
-
-
🟢 🔰 Problem 147/200: 3Sum in Python ◼️ Welcome to Problem 147 of my FREE Python Problem-Solving Series! Problem: Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. 🟩 STEPS TO SOLVE: Sort the Array: Sorting helps to easily skip duplicates and use the two-pointer technique. Find Triplets: Iterate through the array and use two pointers to find pairs that sum up to the target.
To view or add a comment, sign in
-
-
To get the current date and time in Python in the format YYYY-MM-DD H:M:S, use the datetime.now() function and import the datetime library. You can also generate integer type date as well as the string character type like 'Sun Feb DD H:M:S YYYY' using time.ctime(). Let's find out with the examples given below.
To view or add a comment, sign in
-
“We cannot assign anything to True as True is a reserved Python keyword. I hope you answered this correctly.“ Read this story from Liu Zuo Lin on Medium: https://lnkd.in/ehJyVpfD
To view or add a comment, sign in
-
How to Initialize a Dictionary with Values: A Complete Guide with Examples You can initialize a dictionary with values by specifying key-value pairs within curly braces {}. Here's an example: https://lnkd.in/gR_b66Yv #python #pythondictionary #BoostrNetWave #lingarajtechhub
To view or add a comment, sign in
-
Q. What will be the output of the following code snippet? my_list = [1, 2, 3, 4, 5] reversed_list = my_list[::-1] print(reversed_list) Output-c Q. How do you remove an item from a list in Python? a) Using pop() b) Using remove() c) Using discard() d) All of the above Output-d Q. Which of the following is an example of an immutable data type in Python? a) List b) Set c) Tuple d) Dictionary Output-c Q. What will be the output of the following code snippet? my_tuple = (1, 2, [3, 4]) my_tuple[2].append(5) print(my_tuple) Output- Error Q. Which of the following data types in Python is unordered and does not allow duplicate elements? a) List b) Tuple c) Set d) Dictionary Output- c If you want explanations, watch the video. https://lnkd.in/eJh_-KqX
To view or add a comment, sign in