395
订阅者
+724 小时
+77 天
+730 天
帖子存档
Java_ The Complete Reference-McGraw Hill (2024) 13th edition pdf
https://t.me/c/2109572262/915
For questions here is the Chat group link
https://t.me/+2KE896TMwHkxOWE1
For Resources aka PDfs and Ebooks group link
https://t.me/+eweUkdFwlho4YjRl
Join Python Channel
https://t.me/python_assets
Answer: Exception
Solution:
class TV:
pass
creates a new data type called TV.
pass is just a no-operation statement, it doesn't add any data or functionality to the class.
Hence, this data type does not contain any attributes or functionality
obj = TV()
creates a new object named obj, of the data type TV.
obj.price = 200
creates a new variable named
price, within obj.
The value of this variable is set to 200.
Finally, we have
print(self.price)
But there is no object named self here!
Hence, we get an Exception stating that there is nothing called self.
But you'd have seen self in other programs elsewhere.
self is not a keyword or pre-defined variable in Python.
It is simply a convention to use self WITHIN methods to denote
the first parameter of the method.
The first parameter of a method is is the object through which the method was invoked.
Eg.
a = [1,2,3]
then
a.append(5)
is equivalent to
list.append(a, 5)
So here, a is implicitly passed to the method append.
The name self is
conventionally used to refer to the implicit argument passed in methods.
Otherwise, the word self has no special meaning in Python.
Hence, the code in the question gives an error, because self is not defined before use.
I hope this helped!
@python_assets
@javascript_resourcesIn Python the comma without any operator or function separating it, is interpreted as a tuple creation, so 1,2 + 3,4 is interpreted as 1,2+3,4 which results in (1,5,4)
For questions here is the Chat group link
https://t.me/+2KE896TMwHkxOWE1
For Resources aka PDfs and Ebooks group link
https://t.me/+eweUkdFwlho4YjRl
Join Python Channel
https://t.me/python_assets
Magazine Shared
Pdf in private channel:
https://t.me/c/2109572262/891
Book shared in resources channel
Name: Web Design Playground - HTML and CSS the Interactive Way - Paul McFedries (Manning, 2019)
https://t.me/c/2109572262/888
Book shared in resources channel
https://t.me/c/2109572262/871
Complete DSA Roadmap🔥
|
|-- Basic_Data_Structures
| |-- Arrays
| |-- Strings
| |-- Linked_Lists
| |-- Stacks
| └─ Queues
|
|-- Advanced_Data_Structures
| |-- Trees
| | |-- Binary_Trees
| | |-- Binary_Search_Trees
| | |-- AVL_Trees
| | └─ B-Trees
| |
| |-- Graphs
| | |-- Graph_Representation
| | | |- Adjacency_Matrix
| | | └ Adjacency_List
| | |
| | |-- Depth-First_Search
| | |-- Breadth-First_Search
| | |-- Shortest_Path_Algorithms
| | | |- Dijkstra's_Algorithm
| | | └ Bellman-Ford_Algorithm
| | |
| | └─ Minimum_Spanning_Tree
| | |- Prim's_Algorithm
| | └ Kruskal's_Algorithm
| |
| |-- Heaps
| | |-- Min_Heap
| | |-- Max_Heap
| | └─ Heap_Sort
| |
| |-- Hash_Tables
| |-- Disjoint_Set_Union
| |-- Trie
| |-- Segment_Tree
| └─ Fenwick_Tree
|
|-- Algorithmic_Paradigms
| |-- Brute_Force
| |-- Divide_and_Conquer
| |-- Greedy_Algorithms
| |-- Dynamic_Programming
| |-- Backtracking
| |-- Sliding_Window_Technique
| |-- Two_Pointer_Technique
| └─ Divide_and_Conquer_Optimization
| |-- Merge_Sort_Tree
| └─ Persistent_Segment_Tree
|
|-- Searching_Algorithms
| |-- Linear_Search
| |-- Binary_Search
| |-- Depth-First_Search
| └─ Breadth-First_Search
|
|-- Sorting_Algorithms
| |-- Bubble_Sort
| |-- Selection_Sort
| |-- Insertion_Sort
| |-- Merge_Sort
| |-- Quick_Sort
| └─ Heap_Sort
|
|-- Graph_Algorithms
| |-- Depth-First_Search
| |-- Breadth-First_Search
| |-- Topological_Sort
| |-- Strongly_Connected_Components
| └─ Articulation_Points_and_Bridges
|
|-- Dynamic_Programming
| |-- Introduction_to_DP
| |-- Fibonacci_Series_using_DP
| |-- Longest_Common_Subsequence
| |-- Longest_Increasing_Subsequence
| |-- Knapsack_Problem
| |-- Matrix_Chain_Multiplication
| └─ Dynamic_Programming_on_Trees
|
|-- Mathematical_and_Bit_Manipulation_Algorithms
| |-- Prime_Numbers_and_Sieve_of_Eratosthenes
| |-- Greatest_Common_Divisor
| |-- Least_Common_Multiple
| |-- Modular_Arithmetic
| └─ Bit_Manipulation_Tricks
|
|-- Advanced_Topics
| |-- Trie-based_Algorithms
| | |-- Auto-completion
| | └─ Spell_Checker
| |
| |-- Suffix_Trees_and_Arrays
| |-- Computational_Geometry
| |-- Number_Theory
| | |-- Euler's_Totient_Function
| | └─ Mobius_Function
| |
| └─ String_Algorithms
| |-- KMP_Algorithm
| └─ Rabin-Karp_Algorithm
|
|-- Online_Judges_and_Practice_Platforms
| |-- LeetCode
| |-- HackerRank
| |-- CodeChef
| |-- Codeforces
| └─ HackerEarth
|
└─ Interview_Preparation
|-- Commonly_Asked_DSA_Interview_Questions
|-- Mock_Interviews
|-- Problem-Solving_Strategies
|-- Time_and_Space_Complexity_Analysis
└─ Coding_Patterns_and_Techniques
@javascript_resources
@python_assets
------------------- END -------------------
Coding Platforms
• LeetCode
• HackerRank
• CodeChef
• GeeksforGeeks
• TopCoder
Book pdf shared in private channel
📚50 Java Concepts Every Developer Should Know: The Perfect Guide Every Java Developer Needs to Get Started (2023)
@javascript_resources
@python_assets
https://t.me/c/2109572262/862
Dictionaries in Python store data in key-value pairs, allowing you to quickly retrieve values associated with a particular key.
The code defines a
Book class with methods to set and get the price attribute. After creating an instance obj, the set_price method increments the price by 1. Later, calling get_price adds another 1 to the price, resulting in 17 being printed, as the initial value 15