Posts

Showing posts from September, 2021

STRINGS IN PYTHON

Image
 ALL ABOUT STRINGS IN PYTHON THIS IS CODE OF STRINGS IN PYTHON YOU CAN COPY PASTE THIS CODE AND RUN  THIS CODE AND SEE THE OUTPUT IN THIS CODE I HAVE COVER ALMOST WORK RELATED  TO STRINGS  #string print ( "Hello" ) print ( 'Hello' ) #Assign String to a Variable b = "Hello" print ( b ) #Multiline Strings c = """Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.""" print ( c ) #Strings are Arrays z = "Hello, World!" print ( z [ 1 ]) #Looping Through a String for x in "banana" : print ( x ) #String Length d = "Hello, World!" print ( len ( d )) #Check String txt = "The best things in life are free!" print ( "free" in txt ) #(slicing in string) #Slice To the End n = "Hello, World!" print ( n [ 2 :]) #negative slicing in string m = "Hello, World!" print (

Datatypes in python

Image
  THESE ARE THE DATA-TYPES IN PYTHON Copy and paste this code in  your code editor and save it with the extension of( .py) and run it so you can see the output of the code that what is generated in output. a = "Hello World" #str b = 20 #int c = 20.5 #floats d = 1j #complex e = ["apple", "banana", "cherry"] #list f = ("apple", "banana", "cherry") #tuple g = range(6) #range h = {"name" : "John", "age" : 36} #dict i = {"apple", "banana", "cherry"} #set j = frozenset({"apple", "banana", "cherry"}) #frozenset k = True #boolean l = b"Hello" #bytes m = bytearray(5) #bytearray n = memoryview(bytes(5)) #memoryview print(a) print(b) print(c) print(d) print(e) print(f) print(g) print(h) print(i) print(j) print(k) print(l) print(m) print(n) This is my youtube channel for datatypes click and watch it   For notes you ca