  C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD # Can anybody explain me print statement in this code?  » python-3.x » Can anybody explain me print statement in this code?

By : user3100356
Date : January 12 2021, 07:00 PM
fixed the issue. Will look into that further for i in range(0, 1<Here, 1 << n shifts 1 by n bits to left. It means: code :
``````gray=i^(i>>1)
``````
``````   if i = 1, 1 >> 1 would be 0,
i = 2, 10 >> 1 would be 1 [2 = binary 10]
i = 3, 100 >> 1 would be 10 (in binary) 2 in decimal
``````
``````0 ^ 0 = 0,
0 ^ 1 = 1 ^ 0 = 1,
1 ^ 1 = 0
``````
``````print "{0:0{1}b}".format(gray,n)
`````` ## Can anyone explain me what does this particular print statement do in for loop?

By : Alexander
Date : March 29 2020, 07:55 AM
I wish this helpful for you This is the CBCPAT, the Confusing But Correct Pointer Arithmetic Trick.
Since array subscription in C++ (and C) is done using pointer arithmetic, if a is an array and i is the index (an integer), then
code :
``````a[i]
``````
``````*(a + i)
``````
``````*(i + a)
``````
``````i[a]
``````
``````(a + i - 1)[(a - i)[i] % N]
``````
``````(a + i - 1)[1 % N]
``````
``````(a + i - 1)[1 % 5],
``````
``````*(a + i - 1 + 1)
``````
``````a[i]
`````` ## Explain println and print statement after a loop has been executed in Java?

Date : March 29 2020, 07:55 AM
Hope that helps Actually print prints the s where the line stops!. The problem here is, println already put a new line first, and then print starts from that place. ## Could someone explain why my print statement isn't printing both variables on one line?

By : Carlos Ventura
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , That's because every line ends with a new line character '\n'. You need to strip them, using say str.rstrip:
code :
``````for i, line in enumerate(currentFile):
line = line.rstrip()
if 'Date Released' in line:
print(line + ' ' + names)`````` ## Can some explain how many times is the print statement being executed

By : user1947070
Date : March 29 2020, 07:55 AM
Does that help The loop runs 2n times the first iteration, and then 1 less each time until the (n+1)'th iteration when it runs n times.
code :
``````2n + (2n-1) + (2n-2) + … + n
``````
``````(n+1)*n + (2n-n) + (2n-1-n) + … + (n-n)
``````
``````(n+1)*n + n + (n-1) + (n-2) + … + 0
``````
``````(n+1)*n + (n+1)*n/2
``````
``````n^2 + n + (n^2)/2 + n/2
``````
``````1.5n^2 + 1.5n
`````` ## Explain using statement in C# code in middle of code... (not in header as loading libraries)

By : user3440116
Date : March 29 2020, 07:55 AM
like below fixes the issue using is used in conjunction with types that implement the IDisposable interface.
It ensures that when the object is out of scope, the Dispose method is called (as defined in IDisposable) and is often used to dispose of unmanned resources.
code :
``````var font1 = new Font("Arial", 10.0f);
byte charset = font1.GdiCharSet;
font1.Dispose();
``````
``````var font1 = new Font("Arial", 10.0f);
try
{
byte charset = font1.GdiCharSet;
}
finally
{
if (font1 != null)
{
font1.Dispose();
}
}
`````` 