Skip to content

How to check if a string is a palindrome?

I have a code to check whether a word is palindrome or not: If a word is inputted, for example : rotor , I want the program to check whether this word is palindrome and give output as “The given word is a palindrome”. But I’m facing problem that, the program checks first r and r and prints &…

Python Indentation with For, While and Try

I’ve written a small program to simulate a paper, scissor, rock game. I’m using a for-loop to control the round-of-3 behaviour and am using while and try to control user input. I don’t believe python is running the code within the game evaluation logic, but I’m not too sure why. I thin…

Preferred way of resetting a class in Python

Based on this post on CodeReview. I have a class Foo in Python (3), which of course includes a __init__() method. This class fires a couple of prompts and does its thing. Say I want to be able to reset Foo so I can start the procedure all over again. What would be the preferred implementation? Calling the __i…

Calculating monthly mean from daily netcdf file in python

Hello I have a netcdf file with daily data. Shape of the file is (5844, 89, 89) i.e 16 years data. I tried to get monthly average from daily data. I am looking for simillar to resample function in pandas dataframe. Is there anyways to do that in python. As I know it is very easy to calculate by using

Run Multiple Instances of ChromeDriver

Using selenium and python I have several tests that need to run in parallel. To avoid using the same browser I added the parameter of using a specific profile directory and user data (see below). The problem is that I cannot run them simultaneously, one test needs to wait for the other to finish. Otherwise I …