
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

2K+ Views
When it is required to take a number and compute a specific pattern, the value of n is taken from the user. Next, two variables are assigned this specific pattern and their sum is calculated.Below is a demonstration of the same −Example Live Demomy_input = int(input("Enter a value for n...")) temp_val = str(my_input) t_1=temp_val+temp_val t_2=temp_val+temp_val+temp_val my_result = my_input+int(t_1)+int(t_2) print("The computed value is : ") print(my_result)OutputEnter a value for n...4 The computed value is : 492ExplanationAn input from the user is taken.It is converted into a string and assigned to a variable.The value of ‘n*n’ and the value of ‘n*n*n’ is calculated.Their ... Read More

2K+ Views
When it is required to sort the elements of an array in descending order, the ‘sort’ method can be used by specifying a parameter named ‘reverse’ to True.Below is a demonstration of the same −Example Live Demomy_list = [44, 56, 42, 31, 11, 23, 78, 89, 9, 0] print("The list is :") print(my_list) my_list.sort(reverse = True) print("The list after sorting is :") print(my_list)OutputThe list is : [44, 56, 42, 31, 11, 23, 78, 89, 9, 0] The list after sorting is : [89, 78, 56, 44, 42, 31, 23, 11, 9, 0]ExplanationA list is defined, and is displayed on the console.The ... Read More

830 Views
When it is required to sort the elements of an array in ascending order, the ‘sort’ method can be used. It helps sort the elements in ascending order by default. If we want it to be sorted in descending order, a parameter named ‘reverse’ can be set to True.Below is a demonstration of the same −Example Live Demomy_list = [44, 56, 42, 31, 11, 23, 78, 89, 9, 0] print("The list is :") print(my_list) my_list.sort() print("The list after sorting is :") print(my_list)OutputThe list is : [44, 56, 42, 31, 11, 23, 78, 89, 9, 0] The list after sorting is : ... Read More

532 Views
When it is required to right rotate the elements of a list, the elements are iterated over, and a last element is assigned a value, after which the elements are iterated over, and an element is swapped.Below is a demonstration of the same −Example Live Demomy_list = [31, 42, 13, 34, 85, 0, 99, 1, 3] n = 3 print("The value of n has been initialized to") print(n) print("The list is :") print(my_list) print("List is being right rotated by 3 elements...") for i in range(0, n): last_elem = my_list[len(my_list)-1] for j in range(len(my_list)-1, -1, -1): ... Read More

645 Views
When it is required to print the elements of a list that are present at even index/position, a loop can be used to iterate over the elements, and only check the even positions in the list by specifying the step size as 2 in the range function.Below is a demonstration of the same −Example Live Demomy_list = [31, 42, 13, 34, 85, 0, 99, 1, 3] print("The list is :") print(my_list) print("The elements in odd positions are : ") for i in range(0, len(my_list), 2): print(my_list[i])OutputThe list is : [31, 42, 13, 34, 85, 0, 99, 1, 3] The elements ... Read More

2K+ Views
When it is required to print the elements of a list that is present in odd index/position, a loop can be used to iterate over the elements, and only check the odd positions in the list by specifying the step size as 2 in the range function.Below is a demonstration of the same −Example Live Demomy_list = [31, 42, 13, 34, 85, 0, 99, 1, 3] print("The list is :") print(my_list) print("The elements in odd positions are : ") for i in range(1, len(my_list), 2): print(my_list[i])OutputThe list is : [31, 42, 13, 34, 85, 0, 99, 1, 3] The elements ... Read More

783 Views
When it is required to print the elements of an array in reverse order, the list can be iterated over from the end.Below is a demonstration of the same −Example Live Demomy_list = [21, 32, 43, 54, 75] print("The list is : ") for i in range(0, len(my_list)): print(my_list[i]) print("The list after reversal is : ") for i in range(len(my_list)-1, -1, -1): print(my_list[i])OutputThe list is : 21 32 43 54 75 The list after reversal is : 75 54 43 32 21ExplanationA list is defined, and is displayed on the console.The list is iterated over, and displayed.It is reversed ... Read More

2K+ Views
When it is required to print the duplicate elements of an array, the list elements are iterated over, and a nested loop is used.Below is a demonstration of the same −Example Live Demomy_list = [1, 2, 5, 6, 8, 9, 3, 4, 8, 9, 1, 8] print("The list is :") print(my_list) print("The duplicate elements in the list are : ") for i in range(0, len(my_list)): for j in range(i+1, len(my_list)): if(my_list[i] == my_list[j]): print(my_list[j])OutputThe list is : [1, 2, 5, 6, 8, 9, 3, 4, 8, 9, 1, 8] The duplicate elements in ... Read More

2K+ Views
When it is required to left rotate the elements of an array, the array can be iterated over, and depending on the number of left rotations, the index can be incremented that many times.Below is a demonstration of the same −Example Live Demomy_list = [11, 12, 23, 34, 65] n = 3 print("The list is : ") for i in range(0, len(my_list)): print(my_list[i]) for i in range(0, n): first_elem = my_list[0] for j in range(0, len(my_list)-1): my_list[j] = my_list[j+1] my_list[len(my_list)-1] = first_elem print() print("Array after left rotating is ... Read More

535 Views
Problem Statement: Use boto3 library in Python to find out whether a function can paginate or not in AWS secret.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: secret_function is the required parameter in this function.Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is not mentioned, then explicitly pass the region_name while creating the session.Step 4: Create an AWS client for secretmanager.Step 5: Now use the can_paginate function and pass the parameter secret_function.Step 6: It returns True if the function can paginate; ... Read More