Tuesday, 17 March 2026

Python list Interview Q&A

 #----------------List Interview Question For Zero to Adv Level--------

# Reverse a list

number=[10,30,20,40,60,90,80,100]

# using sort and reverse keyword we can use

number.sort(reverse=True)

print(number) # result [100, 90, 80, 60, 40, 30, 20, 10]

number1=[10,30,20,40,60,90,80,100]

#without Sort and reverse key word

print(number1[::-1]) #result [100, 80, 90, 60, 40, 20, 30, 10]

#2. Find largest & smallest

number2=[10,30,20,40,60,90,80,100]

print(max(number2)) # Max Number is 100

print(min(number2)) # Min Number is 10

print(sum(number2)) # Sum of Number is 430

#3.Count occurrences

number2=[10,30,20,40,20,20,20,60,90,80,100]

print(number2.count(20)) # Result is 4

#4.Remove duplicates

print(list(set(number2))) #[100, 40, 10, 80, 20, 90, 60, 30]

#5 Second_largest number in list

L1=list(set(number2)) # Remove Duplicates

L1.sort() # sort the List

print(L1[-2]) # Find the Second_Highest Number

mylist = ['apple', 'banana', 'cherry']

mylist[1:2] = ['kiwi', 'mango']

print(mylist) 

print(mylist[2])



Python List Full Infromation with Interview questions

 #LIST --List one of the data type in python

#A List is a collection of items stored in a single variable.

#list can store multiple values with comma speciation

#list we can identify  begins with an opening square bracket and

#ends with a closing square bracket, []

#A list value looks like this: ['cat', 'bat', 'rat', 'elephant'].

# list is Ordered,Mutable (changeable),Allow duplicates ,Can store different data types

#

animals=["cat","rat","Cow","Hen","horse","dog"]

print("Name of the animals Is",animals)

#in List data type we can store String values ,Int values ,flote values anything

animals_digits=["cat","0","rat","1","Cow","2","Hen","3","horse","4","dog","5"]

print("Name of the animals Is",animals_digits)

#Just as an index can get a single value from a list,

#List value Index --> it will Index first value from list

print(animals_digits[0])

print(animals_digits[1]) #it will Index 2 value from list

print(animals_digits[2]) #it will Index 3 value from list

print(animals_digits[-1]) #it will Negative Index Last value from list

print(animals_digits[-2])

#a slice can get several values from a list, in the form of a new list

print(animals_digits[0:4]) # Get 0,1,2,3 values from List # means 0-cat,1-0,2-rat,3-1

text = "HELLO"

print(text[1])     # E

print(text[1:2])   # E (but type is different!)

text = "PYTHON"

print(text[::2]) # Result is PTO Means Step = 2 (skip one)

Blak = "Mahen"

print(Blak[1:10])

#-------------------------------------------------

text = "HELLO"

print(text[1:2] == text[1]) # Result should be True

# Both are 'E', but types conceptually differ (still equal)

#---------------------------------------------------

nums = [10, 20, 30, 40]

print(nums[-3:-1])

#While Slicing start included, stop excluded

#Changing the Values in List

nums[0]=200 # Old Nums [10, 20, 30, 40]

print(nums) #Result should be [200, 20, 30, 40]

#List Concatenation(+) and List Replication(*)

value=[1, 2, 3] + ['A', 'B', 'C']

print(value) # Result is:-[1, 2, 3, 'A', 'B', 'C']

value=[1,2,3]*2

print(value) # Result  Is:[1, 2, 3, 1, 2, 3]

#Removing Values from Lists with del Statements

del value[1] # Result  Is:[1, 2, 3, 1, 2, 3]

print(value) #Result [1, 3, 1, 2, 3]

#Adding Values to Lists with the append() and insert() Methods

# sy : string.append(value)

s1=[1,2,3,'python','java']

s1.append('C++')

print(s1) #[1, 2, 3, 'python', 'java', 'C++']

#Insert Method SY: Insert(index,object)

str=[1,2,3,'python','java']

str.insert(2,'C') #[1, 2, 'C', 3, 'python', 'java']

print(str)

#Removing Values from Lists with remove()

str1=[1,2,3,'python','java']

str1.remove(2)

print(str1) # result [1, 3, 'python', 'java']

#Sorting the Values in a List with the sort() Method

str2=[0,5,13,9,6,20,15]

str2.sort() # result [0, 5, 6, 9, 13, 15, 20]

print(str2)

str2.sort(reverse=True) # result [20, 15, 13, 9, 6, 5, 0]

print(str2)

str3=[1, 3, 2, 4, 'Alice', 'Bob']

#str3.sort()

print(str3) #TypeError: '<' not supported between instances of 'str' and 'int'

#A list value is a mutable data type: It can have values added, removed, or changed.

#List Copy

l1=str1.copy() #str1 copy into l1

print(l1)

#========== real Time Interview question ===============

#Find the largest Number in given LIST

Numbers=[10,20,30,50,60] # Largest Number is 60

print(max(Numbers))  #->60

#Find the second-largest number in List

Numbers=[10,20,70,50,90,15,20,80,20,25,100]

Numbers.sort(reverse=False)

print(Numbers[-2])  # result 90

# Remove Duplicates in Given List

Number1=[10,20,70,50,90,15,20,80,20,25,100]

unique=list(set(Number1))

print(unique) #-->[100, 70, 10, 15, 80, 50, 20, 25, 90]

# List Unpacking

a, b, c = [10, 20, 30]

print(a, b, c) #

print(a+b)

print(a)

#Reveses list Using Reverse keyword without using reverse key word

nums = [1,2,3,4]

nums.sort(reverse=True)

print(nums)

print(nums[::1])#-Result [4, 3, 2, 1]



Even and Odd Value Find in python along examption handling

try:

    number = int(input("Enter a number: "))

    if number % 2 == 0:

        print("Even")

    else:

        print("Odd")

except ValueError:

    print("Invalid input! Please enter a valid number.") 

Funtion in Python

 #Input Function  waits for the user to type some text on the keyboard

myname=input("Enter your Name :")

print("Hello ,My Name is ", myname)

#len() length Function Find the Number Words given String out Put Should Be Integer

#Example len(Python)---> Python having 6 Charters

print("Length of Python Is ",len("python"))

# integer to String Convertion in Python

value ='I have eaten ' + str(99) + ' burritos.'

print(value)

#string to integer convertion in Python

value="99"

print(1+int(value))

#The == operator (equal to) asks whether two values are the same as each

#other.

#The = operator (assignment) puts the value on the right into the variable

#on the left.

Monday, 16 March 2026

ZERO to Hero Level Print Function Details in Python

# print Function in Python its   built-in    functions
#Print Function Display the result in Console/screen to user
#print function having multiple parameter
#---------Jut Print Hello world use Below Statement--
print("Hello World ")
#Printing Multiple Values
a=10
b=20
print(a+b)    # add two Numbers with sum
print(a , b ) # add Space to the values
# if u want Space in Each Value Using Seprator parameter In Print Function


print("Python", "Java", "C++", sep=" ** ")

#end Parameter Will Work Wat u need put end of statement

print("Python", "Java", "C++", sep=" ** ",end=" etc ....!")

#Flash value should true or false(It forces immediate output.) below \n means print result in new line

print("\n","Python", "Java", "C++", sep="%",end=" etc ....!",flush=False)
print("\n","Python", "Java", "C++", sep=" --",end=" etc ....!",flush=True)

#\t means new tab and \\ means Backslash \" menas Double quote

print("Hello\tworld", "hello\\world", "hello \" world")

#Syntax:print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)

#objects    values to print sep    separator end  line ending file   output location

#flush  force output

 END ZERO to Hero Level Print Function Details in Python


Saturday, 18 January 2025

Scinario Based interview Question .....

 How To Achieve The Scenario.

Input

File1.csv 

id,Name

1,Mahendra

File2.csv

City, State

Hyd,Telangana

File3.csv

Stateid

Ts

I want Out put

File.Csv

Id,Name,City,State,StateId

1,Mahendra,Hyd,telangana,Ts


Solution:-

[tFileInputDelimited (File1)] --> [tAddRowNumber] -->|

                                                      |

[tFileInputDelimited (File2)] --> [tAddRowNumber] -->|--> [tMap] --> [tFileOutputDelimited (File.csv)]

                                                      |

[tFileInputDelimited (File3)] --> [tAddRowNumber] -->|


SQL very Important Questions :-

 SQL very Important Questions :-

--->--Find the Dupilcates From Table

SELECT JOB,COUNT(JOB) FROM EMP

 GROUP BY JOB

HAVING COUNT(JOB)>1;

---> Delete Duplicate From table

DELETE FROM  EMP E WHERE ROWID<> (SELECT MIN(ROWID) FROM EMP Y 

WHERE E.EMPNO=E.EMPNO);

-->dISPALY nTH SALARIES

SELECT * FROM(SELECT DENSE_RANK() OVER(ORDER BY SAL DESC)AS RNK,E.*FROM EMP E)

WHERE RNK=1;

Select * from emp where Rownum <= 5;

select rownum, e.* from emp e where rownum<=(select count(*)/2 from emp);

--->

select distinct A.empno, A.ename,a.sal,b.sal, A.mgr, B.empno, B.ename

from EMP A, EMP B where A.mgr = B.empno and A.sal > B.sal ;


Python list Interview Q&A

 #----------------List Interview Question For Zero to Adv Level-------- # Reverse a list number=[10,30,20,40,60,90,80,100] # using sort and ...