Indexing and slicing with strings : string = 'abcdefghijk' string[STARTING_INDEX_POSITION:GO_UPTO_INDEX_POSITION] string[2:] //output cdefghijk string[:3] //output abc note-> it says goes upto the index d but not include the index d string[3:6] // output def String Concatenation : name = 'Amar' lname = 'Singh' fname = name + lname // output Amar Singh Lost of string inbuild functions are there you can check and explore them like name.split() // ['Amar','Singh'] // split the string based on the white space Print Formatting with String : Format A string with .format() Input : print('my name is {}'.format('Dharmendra')) output : my name is Dharmendra Lists in Python: lists are ordered sequences which holds variety of object types. they use [] and , to separate it list support index & slicing like [1,2,3,4,5] mylist = [1,2,3,4,5] mylist[1:] //[2,3,4,5] has some inbuild functions like .pop, .sort etc Dictionaries in Python ...
Trying to Learn new things on drupal.