How to write a program to accepts a string from console and print the characters that have even indexes?

Example:

If the following string is given as input to the program:
H1e2l3l4o5
Then, the output of the program should be:
Hello

print("Please enter text to print::")
inputchars = input()

if inputchars:
	string = ""
	for i in inputchars:
		if inputchars.index(i)%2 == 0:
			string += str(i)
	
	print('-------------------')
	print("You Entered:", inputchars)
	print("Result:")
	print(string)
# OUTPUT::
Please enter text to print::
H1e2l3l4o5
-------------------
You Entered: H1e2l3l4o5
Result:
Hello

How to find the odd and even numbers using Python?

Here, In below code, user can enter two numbers to find the odd and even numbers between them. The number must be in between 1000 and 3000.

print("Please Enter the Number between 1000 and 3000")

print("Enter the First Number:")
first_number = input()

print("Enter the Second Number:")
second_number = input()

print("First Number: ", first_number)
print("Second Number: ", second_number)


if int(first_number) >= 1000 and int(second_number) <= 3000:
	first_number = int(first_number)
	second_number = int(second_number)

	even_numbers= []
	odd_numbers = []

	for i in range(first_number,(second_number+1)):
		if i%2 is 0:
			even_numbers.append(str(i))
		else: 
			odd_numbers.append(str(i))
	
else:
	print("Please enter a number between 1000 and 3000")

Most Useful Git commands for Terminal use

Git

Downloads an Existing Git repository to your local computer.

Git
git clone

// Example: git clone https://github.com/user/git-url.git

The “clone” command downloads an existing Git repository to your local computer. You will then have a full-blown, local version of that Git repo and can start working on the project.

Typically, the “original” repository is located on a remote server, often from a service like GitHub, Bitbucket, or GitLab). That remote repository’s URL is then later referred to as the “origin”.

** Example::
In its simplest (and most common) form, only the repository URL is specified:

cd folder/to/clone-into/

This will download the project to a folder named after the Git repository (“git-crash-course” in this case). If you want a different folder name, simply specify it as the last parameter:

git clone https://github.com/user/git-url.git

This will download the project to a folder named after the Git repository (“git-crash-course” in this case). If you want a different folder name, simply specify it as the last parameter:

git clone https://github.com/user/git-url.git other-name

# Update <MyBranch> with Local


Update with Local Branch

Check current Branch:

git branch

Checkout the <MyBranch>

git checkout MyBranch

Check Status of Files:

git status

Add changes files

git add .

Commit Changes Files:

git commit -m "Any Message againt update"

Update Git repository:

git push

# Update Master with <MyBranch>

Update Master with

merge master branch with current branch:
(Currently on branch development)

$ git merge master

** here, After merge master if any merge conflicts found, resolve conflicts here & run check if it is ok.

Checkout Master:

git checkout master

Merge into Development branch:

(now, there won’t be any conflicts in Master as solved in development branch)

git merge development

git merge development 

or, Merge Branch Development with master Branch with a Commit Message

git merge <development> --commit -m "merge branch development to master"

Django- Set created & updated date/time in your models

In Django, many of us have question how to create date time in database automatically, When a new data is inserted or Existing Data is Updated.

So, Now we can use to have the date a record was added, or most recently updated. Django makes this really easy.

class Blogs(models.Model):
    title = models.CharField(max_length=100)
    added = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)

How to hide the div one by one using jquery?

<!DOCTYPE html>
<html>
<head>
<title>Demo - Devchandan</title>
<meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
	<div class="row main_block">
		<div class="col-sm-4 sub_block sub_block_1">
			<h3>Column 1</h3>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
			<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...</p>
		</div>
		<div class="col-sm-4 sub_block sub_block_2">
			<h3>Column 2</h3>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
			<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...</p>
		</div>
		<div class="col-sm-4 sub_block sub_block_3">
			<h3>Column 3</h3>        
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p>
			<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris...</p>
		</div>
	</div>
	<div class="row">
		<div class="col-sm-12">
			<button class="btn btn-primary clickme">Click Me!</button>
		</div>
	</div>
</div>

<script type="text/javascript">
	$(function(){
		var sub_blocks = [];
		$("div.main_block").find('div.sub_block').each(function(key,val){
			let subdiv_cls = 'sub_block_'+(key+1);
			sub_blocks.push(subdiv_cls);
		});	
		var blocks_display 	= sub_blocks;
		var blocks_hide 	= [];
		$('button.clickme').on('click', function(){
			var cls = blocks_display.shift();
			$.each(blocks_display, function(key,divclass){
				$('.'+ divclass).show();
			})
			$('.'+ cls).hide();
			blocks_display.push(cls);
		});
	});
</script>
</body>
</html>