Python program
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.
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/07/2021
HackerRank Join over 7 million developers in solving code challenges on HackerRank, one of the best ways to prepare for programming interviews.
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])
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
Click here to claim your Sponsored Listing.
Category
Culinary Team
Attire
Contact the school
Telephone
Website
Address
Kanpur
Kanpur