# Python

## Python Program to Check Armstrong Number Using Functions

Let’s have a glance at how to check Armstrong’s number using the function in Python programming language. What is Armstrong’s number? Armstrong number is a number that is equivalent to the sum of cubes of its digits. For example 0, 1, 153, 370, 371 and 407 are the Armstrong numbers. Let’s try to understand why 407 is an …

## Write a Program to Display Your Name in Python

Let’s have a glance at how to print a name in python. Write a Program to Display Your Name in Python def print_details(): name= “Mike” print(‘Name: ‘ + name) print_details() Output Name: Mike

## Python Program to Print Student Details

Let’s have a glance at the Python program which will help you to print students’ details like name, age, address in a separate line. Python Program to Print Student Details def student_details(): name, age = “Mike”, 25 address = “Mumbai, Maharashtra, India” print(“Name: {}\nAge: {}\nAddress: {}”.format(name, age, address)) student_details() Output Name: Mike Age: 25 Address: …

## Python Interview Questions

Python interview questions are designed for freshers & experienced professionals to help to prepare for upcoming Python Interviews. Python Interview Questions Where is the math.py (socket.py, regex.py, etc.) source file? To quickly check where a module is located, import it and check the module’s __file__ attribute: >>> import math >>> math.__file__ ‘/usr/lib/python2.4/lib-dynload/math.so’ >>> import random …

## Compare List and Tuple in Python

Let’s have a quick glance at how List and Tuple are different from each other by having a look at the below table. Comparison Between List and Tuple in Python List Tuples It is mutable. It is immutable. Lists are surrounded by square brackets []. Tuples are surrounded by parenthesis (). It has a variable …

## Simple Tic Tac Toe Python Code

Let’s have a glance at automatic Tic Tac Toe implementation in Python. Python Code of Simple and Automatic Tic Tac Toe import numpy as np import random from time import sleep def create_board(): return(np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]])) def possibilities(board): l = [] for i in range(len(board)): for j in range(len(board)): …

## Python XML Processing

In this Python tutorial, we will discuss Python XML processing with program and examples. Introduction of XML Processing in Python The Extensible Markup Language (XML) is a markup language that is recommended by the World Wide Web Consortium and available as an open standard. XML is extremely helpful for keeping track of small to medium …

## Python Tuples

In this Python tutorial, let us know about accessing values in tuples, updating tuples or remove elements in a Python tuple using the Python script with suitable examples. Introduction of Python tuples A tuple is a sequence of immutable Python objects like lists. The differences between tuples and lists are, the tuples cannot be changed …

## Python Sending Email

In this Python tutorial, let us discuss about sending an email using Python script with appropriate examples. Introduction of Python Sending Email Simple Mail Transfer Protocol (SMTP) is a protocol that handles sending and routing of e-mail between mail servers. Python gives the smtplib module, which defines an SMTP client session object that can be used to …

## Python Reg Expressions

In this Python tutorial, let us know about Python Reg Expressions with suitable examples. Introduction of Python Reg Expressions  A RegEx, or Regular Expression, is a sequence of characters that forms a search pattern that can be used to check if a string contains the specified search pattern or not. RegEx Module Python has a …