Posts

DICTIONARY & ITS FUNCTIONS EXPLAINED

# dictionary is nothing but key value is pairs # d1 = {} # print(type(d1)) # d2 = {"santosh" : "roti", "amit" : "mutton", "roshan" : "chawal", "balveer" : {"L" : "machchi", "d" : "murga", }} # d2["aslam"] = "biryani" # del d2["aslam"] # print(d2) # d3 = d2.copy() # del d3["roshan"] # d2.update({"leena": "toffee"}) # print(d2.keys()) # print(d2.values()) # # dc = {"mutable": "Which can be change", # "immutable": "Which cannot be changed", # "tuple": "A function which cannot be changed", # "list": "A function which can be changed", # "help": "kisi ki madad karna", # "suggest" : "sujhav dena"} # n1 = input("Enter your word\n") # print("your words meaning is :...

PYTHON LISTS AND LIST FUNCTIONS

# grocery = ["sarso tel", "chawal", "dhaniya", "mirchi", "haldi", "podina", "saboon", "shampoo"] # print(grocery[5]) # numbers = [105, 40, 50, 30, 25, 55, 90, 80] # # numbers.sort() # # numbers.reverse() # print(numbers[::]) # numbers.append(94) # numbers.pop() # numbers.remove(30) # numbers.insert(7,1010) # print(numbers) # mutable = can change, list is the mutable # immutable = cannot change, tupple is the immutable # tp = (23,) # print(tp) # a = 26 # b = 4 # a,b = b, a # print(a, b)

STRING SLICING AND OTHER FUNCTIONS

# mystr = "santosh is a very good boy" # print(len(mystr)) # print(mystr[0:26:1]) ITS CALLED SLICING # print(mystr[::-1]) # print(mystr.isalnum()) # print(mystr.isalpha()) # print(mystr.endswith("bdoy")) # print(mystr.count("s")) # print(mystr.capitalize()) # print(mystr.find("very")) # print(mystr.lower()) # print(mystr.upper()) # print(mystr.replace("a", "an"))

COMMAND AND PRINT FUNCTION & \n FOR A NEW LINE

# for command a line use ctrl+/ like: # please dont remove this line # for multiple command line using this syntax """, like: """ this is a multiline comment dont use it. like this you also type multi line comment in your cods """ # print("Subscribe to santosh gupta official" ,end=" ") # print("or bhai log video ko bhi like kar dena yarr",) # use \n for a new line # print("line1\nline2\nline3") # print("c:\santoshguptaofficial") # print("\asantoshguptaofficial") # print("c'santosh gupta")

VARIABLE, NUMBER AND TYPECASTING

# var1 = "58" # var2 = "45" # var3 = 32 # var4 = 28.5 # print(var1 + str(var3)) # print(var2 + str((var4)) # print(int(var1) + int(var2)) # print(1000 * "Santosh Gupta is the father of python\n{name}") # print("Enter your number here") # inpnum = input() # print("Enter your second number ") # inpnum1 = input() # print("your total", int(inpnum) + int(inpnum1))