Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,134
» Latest member: jax9090nnn
» Forum threads: 21,913
» Forum posts: 22,783

Full Statistics

Online Users
There are currently 3187 online users.
» 2 Member(s) | 3181 Guest(s)
Applebot, Baidu, Bing, Google, albert42, udwivedi923

 
  [Oracle Blog] Prepare for the Migration to JDK 9
Posted by: xSicKxBot - 10-16-2022, 03:49 AM - Forum: Java Language, JVM, and the JRE - No Replies

Prepare for the Migration to JDK 9 

The release date is proposed for September 21, 2017 and it’s time to make sure your code will work with JDK 9. As you probably know, you will still be able to use the classpath and code with any official Java SE APIs and supported JDK-specific APIs. You will run into problems if your code uses certa...

https://blogs.oracle.com/java/post/prepa...n-to-jdk-9

Print this item

  [Tut] Python – Return NumPy Array From Function
Posted by: xSicKxBot - 10-16-2022, 03:49 AM - Forum: Python - No Replies

Python – Return NumPy Array From Function

5/5 – (1 vote)

Do you need to create a function that returns a NumPy array but you don’t know how? No worries, in sixty seconds, you’ll know! Go! ?

A Python function can return any object such as a NumPy Array. To return an array, first create the array object within the function body, assign it to a variable arr, and return it to the caller of the function using the keyword operation “return arr“.

? Recommended Tutorial: How to Initialize a NumPy Array? 6 Easy Ways

Create and Return 1D Array


For example, the following code creates a function create_array() of numbers 0, 1, 2, …, 9 using the np.arange() function and returns the array to the caller of the function:

import numpy as np def create_array(): ''' Function to return array ''' return np.arange(10) numbers = create_array()
print(numbers)
# [0 1 2 3 4 5 6 7 8 9]

The np.arange([start,] stop[, step]) function creates a new NumPy array with evenly-spaced integers between start (inclusive) and stop (exclusive).

The step size defines the difference between subsequent values. For example, np.arange(1, 6, 2) creates the NumPy array [1, 3, 5].

To better understand the function, have a look at this video:

YouTube Video

I also created this figure to demonstrate how NumPy’s arange() function works on three examples:


In the code example, we used np.arange(10) with default start=0 and step=1 only specifying the stop=10 argument.

If you need an even deeper understanding, I’d recommend you check out our full guide on the Finxter blog.

? Recommended Tutorial: NumPy Arange Function — A Helpful Illustrated Guide

Create and Return 2D NumPy Array


You can also create a 2D (or multi-dimensional) array in a Python function by first creating a 2D or (xD) nested list and converting the nested list to a NumPy array by passing it into the np.array() function.

The following code snippet uses nested list comprehension to create a 2D NumPy array following a more complicated creation pattern:

import numpy as np def create_array(a,b): ''' Function to return array ''' lst = [[(i+j)**2 for i in range(a)] for j in range(b)] return np.array(lst) arr = create_array(4,3)
print(arr)

Output:

[[ 0 1 4 9] [ 1 4 9 16] [ 4 9 16 25]]

I definitely recommend reading the following tutorial to understand nested list comprehension in Python:

? Recommended Tutorial: Nested List Comprehension in Python

More Ways


There are many other ways to return an array in Python.

For example, you can use either of those methods inside the function body to create and initialize a NumPy array:

To get a quick overview what to put into the function and how these methods work, I’d recommend you check out our full tutorial.

? Recommended Tutorial: How to Initialize a NumPy Array? 6 Easy Ways

Related Tutorials


Programmer Humor


Q: How do you tell an introverted computer scientist from an extroverted computer scientist? A: An extroverted computer scientist looks at your shoes when he talks to you.


https://www.sickgaming.net/blog/2022/10/...-function/

Print this item

  (Indie Deal) Sniper Giveaways, 505 Games, Days Gone Deals
Posted by: xSicKxBot - 10-16-2022, 03:49 AM - Forum: Deals or Specials - No Replies

Sniper Giveaways, 505 Games, Days Gone Deals

Sniper Giveaways
[www.indiegala.com]

Days Gone at a NICE Crackerjack Deal
[www.indiegala.com]

505 Games Sale, up to 92% OFF
[www.indiegala.com]
https://www.youtube.com/watch?v=R8M3LjoGOXo
Happy Hour: Chicken Agents Bundle
[www.indiegala.com]
https://www.youtube.com/watch?v=_1UC_Uo2H-8


https://steamcommunity.com/groups/indieg...6182222407

Print this item

  (Free Game Key) Rising Hell & Slain: Back From Hell - Free Epic Games
Posted by: xSicKxBot - 10-16-2022, 03:49 AM - Forum: Deals or Specials - No Replies

Rising Hell & Slain: Back From Hell - Free Epic Games

Grab these games on the Epic Games Store

❤️ Rising Hell
Store Page[store.epicgames.com]

❤️ Slain: Back From Hell
Store Page[store.epicgames.com]

The games are free to keep if claimed by: Thursday, 13 October 2022 15:00 UTC.

Next week's freebies:
ToeJam & Earl: Back in the Groove!
Darkwood

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.

?GrabFreeGames.com ?Twitter ?Steam Curator ?Facebook[fb.me]?Discord[discord.gg]
❤️Support us: HumbleBundle Partner[www.humblebundle.com] Fanatical Affiliate[www.fanatical.com]


https://steamcommunity.com/groups/GrabFr...1773445922

Print this item

  PC - Dome Keeper
Posted by: xSicKxBot - 10-16-2022, 03:49 AM - Forum: New Game Releases - No Replies

Dome Keeper



Dome Romantik has grown to become Dome Keeper with beautiful updated pixel art, atmospheric music and sound and more of everything.

Defend your dome from wave after wave of hostile attacks in this roguelike survival miner. Use the time between each attack to dig beneath the surface in search of valuable resources. Use them carefully on powerful upgrades to help you stay alive and make it to the next world.

Publisher: Raw Fury

Release Date: Sep 27, 2022




https://www.metacritic.com/game/pc/dome-keeper

Print this item

  [Tut] Can a Python Dictionary Have a List as a Value?
Posted by: xSicKxBot - 10-15-2022, 08:22 AM - Forum: Python - No Replies

Can a Python Dictionary Have a List as a Value?

5/5 – (1 vote)

Question


? Question: Can you use lists as values of a dictionary in Python?

This short article will answer your question. So, let’s get started right away with the answer:

Answer


You can use Python lists as dictionary values. In fact, you can use arbitrary Python objects as dictionary values and all hashable objects as dictionary keys. You can define a list [1, 2] as a dict value either with dict[key] = [1, 2] or with d = {key: [1, 2]}.

Here’s a concrete example showing how to create a dictionary friends where each dictionary value is in fact a list of friends:

friends = {'Alice': ['Bob', 'Carl'], 'Bob': ['Alice'], 'Carl': []} print('Alice friends: ', friends['Alice'])
# Alice friends: ['Bob', 'Carl'] print('Bob friends: ', friends['Bob'])
# Bob friends: ['Alice'] print('Carl friends: ', friends['Carl'])
# Carl friends: []

Note that you can also assign lists as values of specific keys by using the dictionary assignment operation like so:

friends = dict()
friends['Alice'] = ['Bob', 'Carl']
friends['Bob'] = ['Alice']
friends['Carl'] = [] print('Alice friends: ', friends['Alice'])
# Alice friends: ['Bob', 'Carl'] print('Bob friends: ', friends['Bob'])
# Bob friends: ['Alice'] print('Carl friends: ', friends['Carl'])
# Carl friends: []

Can I Use Lists as Dict Keys?


You cannot use lists as dictionary keys because lists are mutable and therefore not hashable. As dictionaries are built on hash tables, all keys must be hashable or Python raises an error message.

Here’s an example:

d = dict()
my_list = [1, 2, 3]
d[my_list] = 'abc'

This leads to the following error message:

Traceback (most recent call last): File "C:\Users\xcent\Desktop\code.py", line 3, in <module> d[my_list] = 'abc'
TypeError: unhashable type: 'list'

To fix this, convert the list to a Python tuple and use the Python tuple as a dictionary key. Python tuples are immutable and hashable and, therefore, can be used as set elements or dictionary keys.

Here’s the same example after converting the list to a tuple—it works! ?

d = dict()
my_list = [1, 2, 3]
my_tuple = tuple(my_list)
d[my_tuple] = 'abc'

Before you go, maybe you want to join our free email academy of ambitious learners like you? The goal is to become 1% better every single day (as a coder). We also have cheat sheets! ?



https://www.sickgaming.net/blog/2022/10/...s-a-value/

Print this item

  [Oracle Blog] The Pirates of DevOps: Delivering Software
Posted by: xSicKxBot - 10-15-2022, 08:22 AM - Forum: Java Language, JVM, and the JRE - No Replies

The Pirates of DevOps: Delivering Software

Do you have issues with long deploy cycles? Your updates require some form of downtime. Are you losing money by keeping code already developed collecting dust in repositories instead of providing value and functionality for your users? Delivering the best software fast is what separates software com...

https://blogs.oracle.com/java/post/the-p...g-software

Print this item

  (Indie Deal) Playstation, Konami Sales & TAG Giveaways
Posted by: xSicKxBot - 10-15-2022, 08:22 AM - Forum: Deals or Specials - No Replies

Playstation, Konami Sales & TAG Giveaways

Playstation, Konami & more Sales
[www.indiegala.com]
[www.indiegala.com]
Those Awesome Guys Giveaways
[www.indiegala.com]

https://www.youtube.com/watch?v=R8M3LjoGOXo


https://steamcommunity.com/groups/indieg...9016187396

Print this item

  (Free Game Key) Steam Next Fest 2022 Badge
Posted by: xSicKxBot - 10-15-2022, 08:22 AM - Forum: Deals or Specials - No Replies

Steam Next Fest 2022 Badge

As a reminder, this is not for a free game. This is for a free Steam badge.

Login into Steam and visit the "Next Fest" Discovery Queue: https://store.steampowered.com/sale/nextfest, and complete it to earn the 2022 Next Fest profile badge.
Badge on SteamDB: https://steamdb.info/badge/62/

You can level up the badge by completing more "Next Fest" Discovery Queue, after completing the Discovery Queue three times, and after six times.
Enjoy :cleanseal:
Level 1 Badge: https://imgur.com/QHIDzft
After unlocking Level 3 badge: https://imgur.com/IDxVpdT
After Unlocking Level 6 badge: https://imgur.com/YtPQlUj
Level 6 Badge: https://imgur.com/jDkAfms


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.

?GrabFreeGames.com ?Twitter ?Steam Curator ?Facebook[fb.me]?Discord[discord.gg]
❤️Support us: HumbleBundle Partner[www.humblebundle.com] Fanatical Affiliate[www.fanatical.com]


https://steamcommunity.com/groups/GrabFr...9946186067

Print this item

  PC - Grounded
Posted by: xSicKxBot - 10-15-2022, 08:22 AM - Forum: New Game Releases - No Replies

Grounded



The world is a vast, beautiful and dangerous place especially when you have been shrunk to the size of an ant. Explore, build and survive together in this first person, multiplayer, survival-adventure. Can you thrive alongside the hordes of giant insects, fighting to survive the perils of the backyard?

Publisher: Xbox Game Studios

Release Date: Sep 27, 2022




https://www.metacritic.com/game/pc/grounded

Print this item

 
Latest Threads
௹©Croatia Shein COUPON Co...
Last Post: udwivedi923
Less than 1 minute ago
RebatesMe Sign-Up Bonus C...
Last Post: albert42
1 minute ago
௹©Spain Shein COUPON Code...
Last Post: udwivedi923
3 minutes ago
௹©Slovenia Shein COUPON C...
Last Post: udwivedi923
4 minutes ago
௹©Slovakia Shein COUPON C...
Last Post: udwivedi923
5 minutes ago
RebatesMe Grocery Deals E...
Last Post: albert42
6 minutes ago
௹©Romania Shein COUPON Co...
Last Post: udwivedi923
14 minutes ago
௹©Qatar Shein COUPON Code...
Last Post: udwivedi923
16 minutes ago
RebatesMe Fashion Deals F...
Last Post: albert42
16 minutes ago
Apollo Neuro Promo Code $...
Last Post: jax9090nnn
16 minutes ago

Forum software by © MyBB Theme © iAndrew 2016