Python program

Python program

Share

Contact information, map and directions, contact form, opening hours, services, ratings, photos, videos and announcements from Python program, Education, kanpur, Kanpur.

25/07/2022

Identifiers
Identifiers are names that identify variables, functions, modules, classes, and other objects in Python.

The name of an identifier needs to be a letter or underscore (_). The following characters can be alphanumeric or underscore.

Python identifiers are case-sensitive. For example, the counter and Counter are different identifiers.

In addition, you cannot use Python keywords for naming identifiers.

25/07/2022

The comments are as important as the code because they describe why a piece of code was written.

When the Python interpreter executes the code, it ignores the comments.

In Python, a single line comment begins with a hash ( #) symbol followed by the comment. For example:

# This is a single line comment in Python

25/07/2022

Python is a high-level, general-purpose, interpreted programming language.

1) High-level
Python is a high-level programming language that makes it easy to learn. Python doesn’t require you to understand the details of the computer in order to develop programs efficiently.

2) General-purpose
Python is a general-purpose language. It means that you can use Python in various domains including:

Web applications
Big data applications
Testing
Automation
Data science, machine learning, and AI
Desktop software
Mobile apps
The targeted language like SQL which can be used for querying data from relational databases.

3) Interpreted
Python is an interpreted language. To develop a Python program, you write Python code into a file called source code.

12/04/2022

Python Dates :-A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects.

Example :-
import datetime
x = datetime.datetime.now()
print(x)

HackerRank 12/07/2021

HackerRank Join over 7 million developers in solving code challenges on HackerRank, one of the best ways to prepare for programming interviews.

21/02/2021

Write a Python program to reverse the order of the items in the array.

from array import *
array_num = array('i', [1, 3, 5, 3, 7, 1, 9, 3])
print("Original array: "+str(array_num))
array_num.reverse()
print("Reverse the order of the items:")
print(str(array_num))


Output:

Original array: array('i', [1, 3, 5, 3, 7, 1, 9, 3])
Reverse the order of the items:
array('i', [3, 9, 1, 7, 3, 5, 3, 1])

12/02/2021

Write a Python program to find numbers between 100 and 400 (both included) where each digit of a number is an even number. The numbers obtained should be printed in a comma-separated sequence.

items = [ ]
for i in range(100, 401):
s = str(i)
if (int(s[0])%2==0) and (int(s[1])%2==0) and (int(s[2])%2==0):
items.append(s)
print( ",".join(items))


Output:

200,202,204,206,208,220,222,224,226,228,240,242,244,246,248,260,262,264,266,268,280,282,284,286,288,400

07/02/2021

using a for loop and range function
Sample Output:

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5


rows = 6
for num in range(rows):
for i in range(num):
print(num, end=" ")
print(" ")

Output:

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

07/02/2021

Write a Python program to find those numbers which are divisible by 7 and multiple of 5, between 1500 and 2700 (both included).

nl=[ ]
for x in range(1500, 2701):
if (x%7==0) and (x%5==0):
nl.append(str(x))
print (' , '. join(nl))


Output:

1505,1540,1575,1610,1645,1680,1715,1750,1785,1820,1855,1890,1925,1960,1995,2030,2065,2100,2135,2170,2205,2240,
2275,2310,2345,2380,2415,2450,2485,2520,2555,2590,2625,2660,2695

05/02/2021

Python Program to Create a Class and Compute the Area and the Perimeter of the Circle .

import math
class circle():
def __init__(self,radius):
self.radius=radius
def area(self):
return math.pi*(self.radius**2)
def perimeter(self):
return 2*math.pi*self.radius

r=int(input("Enter radius of circle: "))
obj=circle(r)
print("Area of circle:",round(obj.area(),2))
print("Perimeter of circle:",round(obj.perimeter(),2))

OUTPUT:-

Case 1:
Enter radius of circle: 5
Area of circle: 78.54
Perimeter of circle: 31.42

Case 2:
Enter radius of circle: 10
Area of circle: 314.16
Perimeter of circle: 62.83

03/02/2021
Want your school to be the top-listed School/college in Kanpur?

Click here to claim your Sponsored Listing.

Location

Category

Culinary Team

Attire

Telephone

Website

Address


Kanpur
Kanpur