@FTPfbd@MORTHIndia I have been receiving SMS regarding traffic challan, each time for different vehicle number. Plz check your system & update. I neither live in Faridabad nor have a vehicle.
@FTPfbd@MORTHIndia Dear Sir/Madam, received one more SMS couple of minutes back regarding challan. Please check what is wrong with the system and fix it.
@FTPfbd@MORTHIndia Dear Sir/Madam, whole point of raising this issue is that I do not have any vehicle, still getting these SMS, each time with different vehicle number. Seems like your system has a glitch. Plz have it corrected ๐
@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.
@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)
@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.
@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]
@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
@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
@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.