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,155
» Latest member: lucas03215
» Forum threads: 21,831
» Forum posts: 22,706

Full Statistics

Online Users
There are currently 981 online users.
» 0 Member(s) | 975 Guest(s)
Applebot, Baidu, Bing, DuckDuckGo, Google, Yandex

 
  (Indie Deal) Fantastic Tales Bundle, MHR Sunbreak & Racing Deals
Posted by: xSicKxBot - 04-09-2022, 06:56 AM - Forum: Deals or Specials - No Replies

Fantastic Tales Bundle, MHR Sunbreak & Racing Deals

Visual Choice Bundle | 7 VN Steam Games | 93% OFF
[www.indiegala.com]
Be it linear or multiple endings, in these story rich Visual Novels your choice matters! Featuring various art styles and themes like romance, adventure, horror, drama etc.

Choose with what interactive fiction to start: Fires At Midnight, Tell a Demon, Pumpkin Eater, Code Romantic, Gear of Glass: Eolarn's war, Mysteria of the World: The forest of Death & The Evolving World: Catalyst Wake.

https://www.youtube.com/watch?v=15fDyFE48eQ
505 Games Racing Sale, up to 80% OFF
[www.indiegala.com]
Stay Inside, Stay Safe and Enjoy Good Games.
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


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

Print this item

  PC - Persona 4 Arena Ultimax
Posted by: xSicKxBot - 04-09-2022, 06:56 AM - Forum: New Game Releases - No Replies

Persona 4 Arena Ultimax



In P4AU, the characters from Persona 4 and Persona 3 once again find themselves teaming up to face off in the P-1 Climax, a series of battles which must be won before the world ends. The original cast of characters from Persona 3 and 4 are back to discover the mastermind behind the whole tournament, while a few new faces join the fight, including Junpei Iori, Yukari Takeba, Rise Kujikawa, and more. But standing in their way is the dual katana-wielding Sho Minazuki, a huge threat to everyone involved in the P-1 Climax. Worse yet, there's a Sho lookalike who can wield a Persona...

Publisher: Sega

Release Date: Mar 17, 2022




https://www.metacritic.com/game/pc/perso...na-ultimax

Print this item

  News - Halo Infinite Season 2: Lone Wolves Trailer Shows Off What's Coming Next
Posted by: xSicKxBot - 04-09-2022, 06:56 AM - Forum: Lounge - No Replies

Halo Infinite Season 2: Lone Wolves Trailer Shows Off What's Coming Next

Halo Infinite's Season 2: Lone Wolves is coming soon, and 343 Industries has released a new trailer for it that offers a glimpse of what to expect when it arrives May 3.

This includes new maps for Arena and BTB, as well as more modes like the battle royale-style Last Spartan Standing. Players are also getting a new battle pass, and like all Halo Infinite battle passes, it will never expire, so players don't need to rush to complete it before the end of a given season.

According to Halo community director Brian Jarrard, nearly everything on display in the Season 2 is included with the new battle pass either by spending money or grinding. In addition, there will be new items added to the shop and more free event passes throughout Season 2.

Continue Reading at GameSpot

https://www.gamespot.com/articles/halo-i...01-10abi2f

Print this item

  [Oracle Blog] How to Develop Modules with Eclipse IDE
Posted by: xSicKxBot - 04-08-2022, 10:16 AM - Forum: Java Language, JVM, and the JRE - No Replies

How to Develop Modules with Eclipse IDE

The Java Platform Module System (JPMS) main goal is to make it easier to construct and maintain Java libraries and large applications. You will also experience improved application performance by scaling down the Java SE platform and JDK. In a series of five tutorials, Deepak Vohra explains how to u...

https://blogs.oracle.com/java/post/how-t...clipse-ide

Print this item

  [Tut] Is There A Way To Create Multiline Comments In Python?
Posted by: xSicKxBot - 04-08-2022, 10:16 AM - Forum: Python - No Replies

Is There A Way To Create Multiline Comments In Python?

Summary: You can use consecutive single-line comments (using # character) to create a block of comments (multiline comments) in Python. Another way is to use """ quotes to enclose the comment block.


Problem Statement: How to create multiline comments in Python?

Other programming languages like C++, Java, and JavaScript, have an inbuilt mechanism (block comment symbols) for multiline comments, but there is no built-in mechanism for multiline comments in Python. Hence, the following code won’t work:

/* This is a multiline Comment in Python */

The above code will throw an error in Python. However, there are still some workarounds to using the multiline comments in Python. Let’s look at the different methods to do this in this article.

  • Quick Trivia on Comments:
    • Comments are a very important part of every programming language as it explains the logic used in the code. The developers provide these comments to make it more readable and for the users to get a better understanding of the code. The comments don’t run as they are ignored by the interpreters and compilers. Comments also help us while we are debugging, i.e., when there are two lines of code, we can comment one out to prevent it from running.
  • What is a multiline comment in Python?
    • A multiline comment in Python is a comment that generally expands to multiple lines, i.e., multiline comments are the comments that expand to two or more lines in the source code.

Method 1: Using Multiple Single Line Comments


We can use the multiple single-line comments to create multiline comments in Python. But first, you must know how to make a single-line comment is in Python. The Hash character (#) is used to make single-line comments in Python. The commented line does not get printed in the output.

Example:

# print("Hello Finxters")
print("Learning to create multiline comments in Python")

Output:

Learning to create multiline comments in Python

Now let’s create multiline comments using consecutive single line comments:

Example:

print("Learning to create multiline comments in Python")
# print("Hello Finxters")
# print("This is a")
# print("Multiline comment")
# print("in Python")
print("End of program")

Output:

Learning to create multiline comments in Python End of program

As we can see that the commented lines are ignored by the parser in Python, thereby creating a block of comments.

Discussion: Using single-line comments to comment out every line of a multiline comment individually becomes a very tedious process. Hence this method is not recommended to be used when you are not using any modern editor. However, most of the new code editors have a shortcut for block commenting in Python. You can just select a few lines of code using shift and the cursor keys and then press cmd + / (This shortcut may differ depending upon the editor you are using) to comment them out all at once. You can even uncomment them easily by simply selecting the block of comments and pressing the cmd + / keyboard shortcut.

Method 2: Using Docstrings Or Multiline Strings


We can create the multiline comments using multiline strings or docstrings in Python. This method has the same effect but is generally used for documentation strings, not block comments. However, if you want to comment things out temporarily, you can use this method. Python has two types of docstrings-
1) One-Line docstrings
2) Multiline docstrings.

To create a block comment, we use the multiline docstrings. Let’s create multiline comments using docstrings in the following example:

Example 1:

print("Learning to create multiline comments in Python") '''
print("Hello Finxters")
print("This is a")
print("Multiline comment")
print("in Python") '''
print("End of program")

Output:

Learning to create multiline comments in Python End of program

Example 2: Suppose you want to define a block comment inside a function using docstrings you have to do it the following way:

def multiply(x, y): res = x * y """ This is a multiline comment indented properly This function returns the result after multiplying the two numbers """ return res
print("The multiplication of the two numbers is", multiply(10, 5))

Output:

The multiplication of the two numbers is 50
  • Caution:
    • You must always ensure that you have used the indentation for the first """ correctly; otherwise, you may get a SyntaxError.
    • Also, if you are opening a multiline comment using three double quotes """ then you must ensure that you enclose the block with exactly three double quotes as well. If you do nt follow this convention, you will get an error again. For example – if you open a multiline comment with three double quotes and close it using three single quotes, then you will get an error.

Example I: If you don’t intend """ properly, you may get the following error:

def multiply(x, y): res = x * y """ This is a multiline comment indented properly This function returns the result after multiplying the two numbers """ return res
print("The multiplication of the two numbers is", multiply(10, 5))

Output:

File "main.py", line 10 return res ^ IndentationError: unexpected indent

Example II: Let’s visualize what happens when there is a mismatch between the type of triple quotes used.

def multiply(x, y): res = x * y """ This is a multiline comment indented properly This function returns the result after multiplying the two numbers ''' return res
print("The multiplication of the two numbers is", multiply(10, 5))

Output:

 File "C:\Users\SHUBHAM SAYON\PycharmProjects\Finxter\General\rough.py", line 10 print("The multiplication of the two numbers is", multiply(10, 5)) ^ SyntaxError: EOF while scanning triple-quoted string literal

Note: You must always be careful where you place these multiline comments in the code. If it is commented right after a class definition, function, or at the start of a module, it turns into a docstring that has a different meaning in Python.

Example:

def multiply(x, y): """ This is a multiline comment made right after the function definition It now becomes a function docstring associated with the function object that is also accessible as runtime metadata """ res = x * y return res
print("The multiplication of the two numbers is", multiply(10, 3))

Output:

The multiplication of the two numbers is 30

?The difference between the comment and the parser is that the comment is removed by the parser, whereas a docstring can be accessed programmatically at runtime and ends up in the byte code. 

Conclusion


Therefore, in this tutorial, we learned two ways of creating multiline comments in Python –
➨Using consecutive single-line comments.
➨Multiline strings (docstrings).

That’s all for this article. I hope you found it helpful. Please stay tuned and subscribe for more interesting articles and tutorials in the future. Happy learning!

?Authors: Rashi Agarwal and Shubham Sayon


Recommended Read:



https://www.sickgaming.net/blog/2022/03/...in-python/

Print this item

  (Indie Deal) FREE Cursed Sight, Star Wars & Lego Sale
Posted by: xSicKxBot - 04-08-2022, 10:16 AM - Forum: Deals or Specials - No Replies

FREE Cursed Sight, Star Wars & Lego Sale

Cursed Sight FREEbie
[freebies.indiegala.com]
Culminating our Anime Sale[www.indiegala.com] with one final themed FREEbie, Cursed Sight, a truly touching & emotional story featuring branching narratives.

https://www.youtube.com/watch?v=4LE4bocTH0Q
Star Wars & Lego Sale, EMEA ONLY, ALL TITLES 75% OFF
[www.indiegala.com]
Stay Inside, Stay Safe and Enjoy Good Games.
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


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

Print this item

  (Free Game Key) Rogue Legacy & The Vanishing of Ethan Carter - Free Epic Games
Posted by: xSicKxBot - 04-08-2022, 10:16 AM - Forum: Deals or Specials - No Replies

Rogue Legacy & The Vanishing of Ethan Carter - Free Epic Games

Visit the store page and add the games to your account:

Rogue Legacy[store.epicgames.com]

The Vanishing of Ethan Carter[store.epicgames.com]

The Vanishing of Ethan Carter is a recurring giveaway, being given once on the Epic Store on Dec 2021. The games are free to keep until Apr 14th 2022 - 15:00 UTC.

Next week's freebie:
Insurmountable
XCOM 2

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] Epic Tag: GrabFreeGames


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

Print this item

  PC - Monster Energy Supercross - The Official Videogame 5
Posted by: xSicKxBot - 04-08-2022, 10:16 AM - Forum: New Game Releases - No Replies

Monster Energy Supercross - The Official Videogame 5



Enjoy all new customization possibilities with our enhanced Track Editor, and give a boost to your creativity! Mix and match pre-existing modules with the brand new Rhythm Section Editor, to design complex prefab track sections, ready to be shared with the Community. Creating amazing jumps has never been easier. Bring the challenge to a whole new level of fun with the new Split Screen Mode, for exciting Multiplayer challenges to race shoulder to shoulder with your friends on the couch! And when the couch is not enough, compete in exciting races online against the whole world.

Publisher: Milestone S.r.l

Release Date: Mar 17, 2022




https://www.metacritic.com/game/pc/monst...ideogame-5

Print this item

  [Oracle Blog] 2018 Oracle Code One - Java, Java...and more Java!
Posted by: xSicKxBot - 04-07-2022, 05:23 PM - Forum: Java Language, JVM, and the JRE - No Replies

2018 Oracle Code One - Java, Java...and more Java!

The inaugural Oracle Code One conference will shortly take place (Oct 22-25). And so many of you have wondered, asked, and contemplated, “Will Java still be featured in the content?” The answer is: Absolutely, YES! This year’s conference has multiple Java related tracks among the entire collection. ...

https://blogs.oracle.com/java/post/2018-...-more-java

Print this item

  [Tut] Define A Method Outside Of The Class Definition
Posted by: xSicKxBot - 04-07-2022, 05:23 PM - Forum: Python - No Replies

Define A Method Outside Of The Class Definition

Problem Statement: How to define a method outside of class definition in Python?

Example:

# Given Class
class Demo:
# Given Method def foo(self): x = 10 return x

Can we create foo() outside of the class definition or maybe even in another module?

Introduction


We all know Python is an object-oriented programming language, and in Python, everything is an object including properties and methods. In Python, the class is like an object’s constructor for creating the objects. Thus, the variables can be defined inside the class, outside the class, and inside the methods in Python. The variables defined outside the class can be accessed by any method or class by just writing the variable name. So, in this article, we are going to learn how to define a method outside of the class definition.

What are Methods in Python?

As Python is an object-oriented programming language, it has objects that consist of properties. The attributes define the properties of these objects, and the behavior is defined using methods. Methods are reusable pieces of code called at any point in the program and are defined inside the class. Every method is associated with the class and can be invoked on the instances of that class.

For example, we can consider a class named ‘Students’ that contains properties like name, id , and rank. The class also holds behaviors like run, jump , and swim. Suppose an object Stud1 has the following properties:

Name- Finxter
Id – 1020
Rank- 1

Here’s how you can assign the values:

class Student: def __init__(self, name, id, rank): self.name = name self.id = id self.rank = rank def run(self): print(f'{self.name} is a cross country champion!') def jump(self): print(f'{self.name} with the following ID: {self.id} is a high jumper!') def swim(self): print(f'{self.name} secured rank {self.rank} in swimming.') stud1 = Student('Finxter', 1020, 1)
stud1.run()
stud1.jump()
stud1.swim()

Output:

Finxter is a cross country champion!
Finxter with the following ID: 1020 is a high jumper!
Finxter secured rank 1 in swimming.

The above example demonstrated the traditional way of adding functionality (methods) to a Python class. Here, the methods were defined inside the class body. Now, let’s say that you want to define a method outside the class body. How will you do so? Let’s dive into the different approaches to unearth the answers to this question.

Define The Method Outside and Use Inside Class Body


The idea here is to define the method outside the class and then use it inside the class body, as shown below.

Example 1:

# Defining the method outside the class
def foo(self): print("Method foo executed") x = 10 print("Value of x = ", x)
# Using the method inside the class body
class Demo: my_method = foo

You can also define a class first and then add a method or function to it from outside its body, as shown below.

Example 2:

# Define the class
class Demo: pass # Define the method outside the class def foo(self): print("Method foo executed ") # Pass the method to the class
Demo.method1 = foo

Caution: We can even define the functions, methods, and classes in different modules if we want to. However, it is advisable to use example 1 rather than example 2 (defining the class in one module, then importing it into another module and further adding methods to it dynamically) because the class objects may behave differently depending on whether the module has been imported or not.

There’s another way to define the function outside of a class and then further add it. But there is a difference in assigning the function to the instance object or the class. Look at the following example to understand the subtle difference:

class Demo1(object): def __init__(self, bar): self.func = 'Finxter' Demo1.funcbar = bar class Demo2(object): def __init__(self, bar): self.func = 'Finxter' self.funcbar = bar def bar(self): return 'Welcome' + self.func

Explanation: Let’s understand what’s happening here.

  • In case of class Demo1 , funcbar is just like any other normal method that is bound to the instance of the class. Let’s have a look at what this looks like –

  • In case of class Demo 2, funcbar is simply a reference to the bar function, i.e., it is not a bound function. Thus, we must pass the instance for this function for it to work properly.

Using Inheritance


You can even use the methods of a class in another class. In the following example we have a class Helper with certain methods defined within it. All the methods of the class Helper can be inherited by the class Demo as shown below.

class Helper(object): # Subtraction function def subs(self, a, b): return a - b # Addition function def add(self, a, b): return a + b # Multiplication function def mul(self, a, b): return a * b # Division function def div(self, a, b): return a / b
# Given class
class Demo(Helper): def __init__(self): Helper.__init__(self) print("The addition of numbers is", self.add(10, 5)) print("Subtraction of numbers is", self.subs(60, 15)) print("Multiplication of numbers is", self.mul(5, 9)) print("The division of numbers is", self.div(100, 50))
# Main method
if __name__ == '__main__': obj = Demo()

Output:

The addition of numbers is 15
Subtraction of numbers is 45
Multiplication of numbers is 45
The division of numbers is 2.0

Related Read: Inheritance in Python

Conclusion


To sum things up, it is absolutely possible to have functions outside classes in Python. If you want to gather a group of functions in one box then you can simply put them together in the same module. Further, you can nest modules within packages. It is recommended that you should use classes when you have to create a new datatype and don’t just use it to group functions together.

That’s it for this discussion and I hope it helped you. Please stay tuned and subscribe for more interesting articles and discussions in the future. Happy learning!


Article by Shubham Sayon and Rashi Agarwal



https://www.sickgaming.net/blog/2022/03/...efinition/

Print this item

 
Latest Threads
Temu Kod Promocyjny [ald9...
Last Post: lucas03215
1 hour ago
Zweryfikowany Kod Temu [a...
Last Post: lucas03215
1 hour ago
Temu Kupon 30% OFF [ald91...
Last Post: lucas03215
1 hour ago
Kod Rabatowy Temu [ald911...
Last Post: lucas03215
1 hour ago
Jak Działa Kod Temu [ald9...
Last Post: lucas03215
1 hour ago
Kod Temu 400 zł OFF [ald9...
Last Post: lucas03215
1 hour ago
Temu Kupon 400 zł [ald911...
Last Post: lucas03215
1 hour ago
Kod Rabatowy Temu [ald911...
Last Post: lucas03215
1 hour ago
Insta360 Sale USA – Get F...
Last Post: tomen8
4 hours ago
Insta360 USA Coupon [INRS...
Last Post: tomen8
4 hours ago

Forum software by © MyBB Theme © iAndrew 2016