Prem Prakash
2.3K posts

Prem Prakash
@4EverPrem
Python Enthusiast, Runner YT: https://t.co/iDZxYqUWMt
India Katılım Mayıs 2014
49 Takip Edilen195 Takipçiler

@Python_Dv Error.
num is a local variable and exists only in the function fun1, therefore, when it is called outside the function, it will result in error.
English

@clcoding None. append method adds element at the end of the list but returns None.
Below code will print [1, 2, 3, 4]
a = [1,2,3]
a.append(4)
print(a)
English

@Astro_Panditji_ So in this entire world, only Mukesh Ambani and Ratan Tata were born on these two dates ?? Not a single other person was born ???
English

@Python_Dv No output. When 7 is divided by 2, the remainder is 1 and not 0, therefore, the if clause is not met. As a result, none of the print statements are executed. Mind it None is a keyword in Python so None is not the correct answer.
English

@RealBenjizo Error.
Instance methods must always accept the instance as the first parameter. If we insert self in class X6, it will work.
English

@clcoding [-2, -1, 1, 2]
Although not explicitly specified, filter will keep only those values from the nums list which are truthy in nature and filter out falsy values. Zeros are falsy and non-zeros truthy so it outputs [-2, -1, 1, 2]
English

@clcoding [1].
items is a class attribute and not an instance attribute.
English

Python Coding challenge - Day 1033| What is the output of the following Python Code?
Answer with Explanation: clcoding.com/2026/02/python…

English

@clcoding 1 2
if the code is
t = ((1,2),(3,4),(5,6))
for a, b in t:
print(a, b)
It prints
1 2
3 4
5 6
clearly, a is first element and b is second element of each individual tuple in t.
Coming back to code in question, in 2nd iteration, a = 3 so loop breaks out and printing 1 2
English

@Python_Dv [1 3] => it will be without the commas in between 1 and 3
numpy array slicing is same as Python list slicing.
English

@clcoding 1 5
When t is instantiated, t.f is pointing to method f.
t.f() -> method f is called -> self.f = 5 assigns 5 to f but return 1 overwrites it with 1. So t.f() = 1
t.f -> Now t.f is no longer a method after it and as previously is re-assigned to 5, so t.f = 5
English

Python Coding challenge - Day 1015| What is the output of the following Python Code?
Answer with Explanation: clcoding.com/2026/02/python…

English

@PythonPr 5. Python passes values to a variable by object reference. Since y is int, it is immutable, therefore, y is a new object different from x and allocated different memory. Therefore, changes in x does not impact y.
English

@RealBenjizo TypeError.
print("Hello", + name) => either remove the comma or + sign, then it will work.
English

Python Coding challenge - Day 1013| What is the output of the following Python Code?
Answer with Explanation: clcoding.com/2026/02/python…

English

@PythonPr 30
since the if condition is true, values of x and y are re-assigned to 3 and 10 respectively. Therefore, 30
English

@Python_Dv odd. Good question.
a%2 = 4%2= 0.
Now 0 is false in Python, therefore, else clause is executed and odd is printed.
English

@Python_Dv F to be changed to lower case f. Correct code is
import math
print(math.factorial(5))
English

@clcoding 0
return is the end of the function and nothing gets executed after it. So in the first iteration when i is 0, it comes across return, thus exits and outputs 0, never going for subsequent loops.
English
















