The GameCreators Bundle | Save 98% OFF over $300-worth of content
[www.indiegala.com] Become a gamedev on your own & create your dream video game with the help of GameGuru, AppGameKit & a vast selection of asset packs. From Fantasy to Sci-Fi, from buildings to gardens, a mega giant array of options & tools are available for you to choose from.
The games are free to keep until July 21st 2022 - 15:00 UTC.
Next week's freebie: Shop Titans Tannenburg
We are welcoming everyone to join our discord[discord.gg]. We are more active there on finding giveaways, small or large, and there are daily raffles you can participate.
Klonoa Phantasy Reverie Series brings back "Klonoa: Door to Phantomile" and "Klonoa 2: Lunatea's Veil" remastered in one collection to fans new and old. Get ready to set off on an adventure to save the world. Released initially in 1997 by Namco, Klonoa is a side-scrolling platformer featuring a colorful character roster and vibrant game world, it's up to you as Klonoa to embark on a journey to save Phantomile. For the franchise's momentous twenty-fifth birthday, Klonoa: Door to Phantomile and Klonoa 2: Lunatea's Veil are receiving the remaster treatment in a two-in-one set—titled KLONOA Phantasy Reverie Series slated to hit the Nintendo Switch™, PlayStation®5, PlayStation®4, Xbox Series X|S, Xbox One, and Steam. The graphics have received an elegant revamp while Klonoa's beloved world and classic gameplay have been faithfully preserved. The remaster also features an adjustable difficulty level, allowing franchise newcomers to delve right into the action, and long-time fans to get reacquainted with ease.
Posted by: xSicKxBot - 07-15-2022, 12:22 AM - Forum: Lounge
- No Replies
Buy $100 Xbox Gift Card, Get A $20 Target Gift Card As A Bonus
The only thing better than getting money is getting free money, which is the offer that Target currently has available. The deal itself is simple as the purchase of a $100 Game and Grub gift card will earn you a free $20 Target gift card to spend at the retail chain. That statement of free money then is technically correct, which is the best kind of correct.
The Game and Grub gift card can be redeemed on Xbox, Grubhub, Domino's Pizza, Dave & Busters, and at Buffalo Wild Wings. Just don't try to insert a pizza into your Xbox or attempt to eat a Halo Infinite disc, as that will be a waste of $100.
The gift card has no expiration date according to the fine print and once purchased it'll be emailed to you so that it can be redeemed online at participating brands. While Prime Day ended yesterday, you can still check out our Xbox roundup on the best deals for that games console.
Posted by: xSicKxBot - 07-14-2022, 03:51 AM - Forum: Python
- No Replies
How to Fix TypeError: unhashable type: ‘list’
5/5 – (2 votes)
The TypeError: unhashable type: 'list' usually occurs when you try to use a list object as a set element or dictionary key and Python internally passes the unhashable list into the hash() function. But as lists are mutable objects, they do not have a fixed hash value. The easiest way to fix this error is to use a hashable tuple instead of a non-hashable list as a dictionary key or set element.
We’ll show how this is done in the remaining article. The last method is a unique way to still use lists in sets or dictionary keys that you likely won’t find anywhere else, so keep reading and learn something new!
Problem Formulation and Explanation
Question: How to fix the TypeError: unhashable type: 'list' in your Python script?
As you’ve seen in the previous two code snippets, the TypeError: unhashable type: 'list' usually occurs when you try to use a list object as a set element or dictionary key.
But let’s dive deeper to find the real reason for the error:
Minimal Reproducible Error Example: Lists are mutable objects so they do not have a fixed hash value. In fact, the error can be reproduced most easily when calling hash(lst) on a list object lst.
This is shown in the following minimal example that causes the error:
hash([1, 2, 3])
The output is the error message:
Traceback (most recent call last): File "C:\Users\xcent\Desktop\code.py", line 1, in <module> hash([1, 2, 3])
TypeError: unhashable type: 'list'
Because you cannot successfully pass a list into the hash() function, you cannot directly use lists as set elements or dictionary keys.
But let’s dive into some solutions to this problem!
Method 1: Use Tuple Instead of List as Dictionary Key
The easiest way to fix the TypeError: unhashable type: 'list' is to use a hashable tuple instead of a non-hashable list as a dictionary key. For example, whereas d[my_list] will raise the error, you can simply use d[tuple(my_list)] to fix the error.
The error may also occur when you try to use a list as a set element. Next, you’ll learn what to do in that case:
Method 2: Use Tuple Instead of List as Set Element
To fix the TypeError: unhashable type: 'list' when trying to use a list as a set element is to use a hashable tuple instead of a non-hashable list. For example, whereas set.add([1, 2]) will raise the error, you can simply use set.add((1, 2)) or set.add(tuple([1, 2])) to fix the error.
Here’s a minimal example:
my_set = set() # Error: my_set.add([1, 2]) # This is how to resolve the error:
my_set.add((1, 2))
# Or: my_set.add(tuple([1, 2])) print(my_set)
# {(1, 2)}
If you want to convert a list of lists to a set, you can check out my detailed tutorial on the Finxter blog:
Method 3: Use String Representation of List as Set Element or Dict Key
To fix the TypeError: unhashable type: 'list', you can also use a string representation of the list obtained with str(my_list) as a set element or dictionary key. Strings are hashable and immutable, so Python won’t raise the error when using this approach.
Here’s an example:
my_list = [1, 2, 3] # 1. Use str repr of list as dict key:
d = {}
d[str(my_list)] = 'hello Finxters' # 2. Use str repr of list as set element:
s = set()
s.add(str(my_list))
In both cases, we used the string representation of the list instead of the list itself. The string is immutable and hashable and it fixes the error.
But what if you really need a mutable set or dictionary key? Well, you shouldn’t but you can by using this approach:
Method 4: Create Hashable Wrapper List Class
You can still use a mutable list as a dictionary key, set element, or argument of the hash() function by defining a wrapper class, say HackedList, that overrides the __hash__()dunder method.
Python’s built-inhash(object) function takes one object as an argument and returns its hash value as an integer. You can view this hash value as a unique fingerprint of this object.
The Python __hash__() method implements the built-in hash() function.
Here’s the minimal code example that creates a wrapper class HackedList that overrides the __hash__() dunder method so you can use an instance of HackedList as a dictionary key, set element, or just as input to the hash() function:
my_list = [1, 2, 3] class HackedList: def __init__(self, lst): self.lst = lst def __hash__(self): return len(self.lst) my_hacked_list = HackedList(my_list) # 1. Pass hacked list into hash() function:
print(hash(my_hacked_list)) # Output: 3 # 2. Use hacked list as dictionary key:
d = dict()
d[my_hacked_list] = 'hello Finxters' # 3: Use hacked list as set element:
s = set()
s.add(my_hacked_list)
Here’s the content of the dictionary and set defined previously:
{<__main__.HackedList object at 0x0000016CFB0BDFA0>: 'hello Finxters'}
{<__main__.HackedList object at 0x0000016CFB0BDFA0>}
If you want to fix the ugly output, you can additionally define the __str__() and __repr__() magic methods like so:
my_list = [1, 2, 3] class HackedList: def __init__(self, lst): self.lst = lst def __hash__(self): return len(self.lst) def __str__(self): return str(self.lst) def __repr__(self): return str(self.lst) my_hacked_list = HackedList(my_list) # 1. Pass hacked list into hash() function:
print(hash(my_hacked_list)) # Output: 3 # 2. Use hacked list as dictionary key:
d = dict()
d[my_hacked_list] = 'hello Finxters' # 3: Use hacked list as set element:
s = set()
s.add(my_hacked_list) print(d)
print(s)
Beautiful output:
{[1, 2, 3]: 'hello Finxters'}
{[1, 2, 3]}
Summary
The five most Pythonic ways to convert a list of lists to a set in Python are:
[www.indiegala.com] Tackle the summer heat with an even hotter Match3 treat! A selection of casual match3 puzzle games with distinctive elements are waiting to be solved: Gaslamp Cases 2, 100 Days without delays, Funny Pets, Halloween Trouble 2, Catherine Ragnor and the Legend of the Flying Dutchman, Rorys Restaurant Deluxe, Suddenly Meow, Save the Planet, The lost Labyrinth
What would you do if you woke up locked in a dark room, with your hands covered in blood? Play as Luca, and endure the brute torture of MADiSON, a demon that has forced him to continue a gory ritual started decades ago, making him commit abominable acts. Will you be able to finish this sinister ceremony?
Posted by: xSicKxBot - 07-14-2022, 03:51 AM - Forum: Lounge
- No Replies
Klonoa Phantasy Reverie Series Already On Sale For A Nice Discount
Klonoa Phantasy Reverie Series has only been out less than a week, but you can already grab it at a discount from Fanatical. The PC games retailer is selling the remastered double-pack of the PS1-era platformers for $34, a tidy discount from its usual price of $40.
Klonoa first appeared in Klonoa: Door to Phantomile in 1997, followed by Klonoa 2: Lunatea's Veil in 2001. This collection marks the 25th anniversary of the series by compiling them both with updated graphics, new difficulty settings to make the games more approachable, and costume options with DLC. The base compilation game includes a Moo costume set.
This deal is only available for a limited time, so the sale price will expire at approximately 7 PM PT / 10 PM ET. The purchase will activate as a Steam key.
Announcing GraalVM Enterprise in Oracle Cloud Infrastructure DevOps
Today, we are announcing that you can use GraalVM Enterprise directly in Oracle Cloud Infrastructure (OCI) DevOps build pipelines to build high-performance Java applications, at no additional cost.
Posted by: xSicKxBot - 07-13-2022, 10:43 AM - Forum: Python
- No Replies
A Beginner’s Guide to Forex Trading Bots and Python – Practical Projects
Rate this post
Full Course: Check out the full beginner course on Forex trading on this Finxter page (5 video lessons).
As a Python beginner, or anything else new that we dive into, everything is fresh and exciting for a while and we have no problem staying motivated to do the work and move ahead.
It’s no wonder you can stay fired up when you are learning the most popular language, in a field that looks promising for years to come, and its innovations will shape the future. That’s exciting!
There’s a book that summarizes the next step in your journey, whether it be Python, Forex, business, freelancing, or anything else. It deals with what most people call, “being at the intermediate level.”
It’s called “The Dip”, by Seth Godin. Like most “self-help” type books, even though this one is only around 100 pages, it could have been done in 10 or 15. In this case though, the author gets an “A+” for the concept.
The idea that after the honeymoon, there will be a period of uncertain struggle on where to go next. Python has the mother of all dips.
To wrap up this beginner’s guide, I want to help you find your way through the dip and come out the other side a success. That “way” is in the title – “Practical Projects.”
Freelance and Get Some Work that Uses Your Python Skills
Doing a project for someone who doesn’t know how, or have the time to do it themselves, is a great way to put your Python skills to the test.
The great thing about freelancing your skills, is you never know what someone is going to need, and this can give you a great variety of projects.
PRO TIP: Don’t wait until you “feel” ready. You will never feel ready – what you need is confidence – by doing some real work, learning from your mistakes, and not making them again.
Getting started on a platform like Upwork is simple and you will know which projects you can handle, and which ones you can’t – besides, it’s good for you to take a couple that will push your skills and require you to learn how to complete them.
Here are a few more Ideas for some real-world projects:
Data Analysis Projects with Python and Its Libraries
We went through some simple examples of what you can do with data earlier in the series. Let’s break down a sample in detail:
Think about a subject that interests you, and where you can find data collections for that topic.
Do a search and find some downloadable files from their collections.
Pick a file that suits your project, download the CSV, (I hope you’re using Anaconda and Jupyter), clean it up and organize it, then see what types of patterns, if any, you can identify. I grabbed historical data on interest rates from the Fed’s website for my last analysis. There is so much information out there for free that we will never be able to cover a tiny percentage of it. So narrow it down to your specific needs.
Projects and Tests for Forex Trading and Python
Form a hypothesis – “Is there a correlation between the EUR/USD and WTI?” In light of recent global events, one would be safe in questioning crude oil’s affect on the entire world.
Do a comparison – Do you remember in a previous lesson when I demonstrated how to overlay one instrument with another on your charts? This is a simple way to look for correlation. Remember, correlation can be positive or negative.
Look to see if one or the other seems to “lead” its partner. This can be a great way to see into the future – so to speak.
If your theory looks promising, question if there is a way to quantify and automate the information using Python. This would also be a good time to start digging into machine learning. Use Python to streamline the process and set alerts.
This is a hypothetical situation I created as an example. Do not trade any theory from anyone without thoroughly testing it yourself.
Sources for Datasets
Governments collect data and make it available to the public on their websites. Records of everything from NFP to GDP, and weather events can be found with a little effort.
Central banks, the IMF, and the World Bank also issue reports and data on a variety of economic indicators and predictions created by their own experts.
Be wary of “advice” sites that are trying to sell you something – look for facts gleaned from statistics and research instead.
Get on Board with a Broker and Get a Robot
We have already discussed how to choose a broker, and did some analysis together on the subject. With the regulations in place these days, it’s really easy to find one that is legit. It will boil down to personal preference in the end. Make sure you feel comfortable with your choice, and that they have responsive customer service so you can communicate easily.
As a beginner, just like with Python, it’s important to start getting some experience while you’re learning to code your own bots. Using a ready-made bot on a demo account is the best way to get going and see if automated trading is right for you.
REMEMBER: Don’t make it all about the money just yet – the knowledge you’re getting in the process is the real value. If you have followed the steps in this series, you should already be on your way to safely making money with Python.
Bonus for Finishing the Beginner Series on Forex Bots and Python
For all of you who have stuck it out until the end of our beginner series, I’m going to give you some analysis that will demonstrate the many different ways to go about your trade planning – they’re endless, which is what makes Forex so interesting. No matter your style, you can find a system that fits.
In the accompanying video, I’m going to give some high-level tips and analysis on the EUR/USD pair that we have been using in the series, and explain what actually makes currency values change.
Check out the video, and it has been a pleasure sharing this information with you.