Join Regular Classroom : Visit ClassroomTech

April 2021

Python Array – How to delete the first element in array

There are many ways of doing it-1. pop method – list.pop()2. remove method – list.remove(list[index])3. del function – del list[index]4. slicing – list[1:] Here is an example for you Output: Explanation:Here, pop(0) pops the first element from the list.remove(b[0]) removes the element indexed at 0 i.e. the first element.del c[0] deletes the first element indexed

Python Array – How to delete the first element in array Read More »

How to take multiple inputs in one line / single line in Python

There are various methods of taking multiple inputs in a single line. Method 1: One of the method is split() method. This methods splits the input separated by separator. Syntax: input().split(separator) Example 1: Input: Output: Explanation: Here the two inputs are split into two integers and assigned to two variables (x, y). Example 2: Input:

How to take multiple inputs in one line / single line in Python Read More »