Posts

Showing posts from February, 2021

whats the difference between insert and append ? with python code.

"insert" and "append" method in list in Python bigginer basically get confused when to use insert and append method in list. heras is the very simple understanding format of  it.   insert: to add some element in the list at certain position. append: to add element in the list. code: append ................................................................................................................... shop=['bread','banana','egg'] shop.append("apple") print(shop) output: ['bread', 'banana', 'egg', 'apple'] ..................................................................... insert: python code: shop.insert(2,"lemmon") shop output: ['bread', 'banana', 'lemmon', 'egg', 'apple']  

lest just create a basic bot operation in python

 hers the code ....................................python code ...................................................................... name=(input("whats your name :")) print("hello",name) ans=(input("have you thought of black hole today: say yess or no!")) print("iam so glad you said {}, I was thinking the same thing".format(ans)) ........................................................................................................................ output: whats your name :animesh hello animesh have you thought of black hole today: say yess or no!yess! iam so glad you said yess!, I was thinking the same thing hears another: ...........................................python code .......................................................................... #print("how intillegenat are you in the range of 0-10?:") x=(int(input("how intillegenat are you in the range of 0-10?:"))) if (x>=5 and x<=10):     print("you are in