I Received an Error Message That I Don't Quite Understand

Trying to create a ROT13 decoder and I found an error I don't quite understand

When you add 13 to your letter value you have to be able to loop the result back to the beginning of the alphabet which is the entire trick that makes ROT13 work. If you change your translation code to:

translation += ABCs[(letter_value + 13) % 26]

The upper half of the alphabet which would normally give you a value that's bigger than the length of ABCs is guaranteed to always be less than 26.

I don't quite understand the callback function with a parameter of err or error

In your first couple of examples the insertMany and keypress functions are responsible for supplying the callback function with a parameter. (there isn't anything special about err or errors, the functions would pass the error like you would any other parameter)

If want to write a function that supplies a parameter to a callback you definitely can!

function addition(x,y, callback){
var result =x+y;
var error = isNaN(result) ? 'Bad input!' : undefined;
callback(result, error);
}

addition(1, 2, function(res, err) {
console.log(res);
if(err) {
console.log(err);
}
});

addition('apple', 2, function(res, err) {
console.log(res);
if(err) {
console.log(err);
}
});

Error message: "'chromedriver' executable needs to be available in the path"

You can test if it actually is in the PATH, if you open a cmd and type in chromedriver (assuming your chromedriver executable is still named like this) and hit Enter. If Starting ChromeDriver 2.15.322448 is appearing, the PATH is set appropriately and there is something else going wrong.

Alternatively you can use a direct path to the chromedriver like this:

 driver = webdriver.Chrome('/path/to/chromedriver') 

So in your specific case:

 driver = webdriver.Chrome("C:/Users/michael/Downloads/chromedriver_win32/chromedriver.exe")

Struggling to Understand Error Message

According to this documentation the parameters to trapz(y, x, dx, axis) are:

  • y - Array like - input array to integrate.
  • x - Optional array - If x is None, then spacing between all y elements is dx.
  • dx - Optional scalar - If x is None, spacing given by dx is assumed. Default is 1.
  • axis - Optional Int - specify the axis.

So you shouldn't specify both x and dx - one of them should be None.

Perhaps this is what you want: trapz(Bwavelength, None, h).

See this answer for more details on the error message and NumPy's "braodcasting rule".



Related Topics



Leave a reply



Submit