Posts

Showing posts from January, 2020
Image
Home Learn Python Basics Lists Dictionary Code Snippets Modules Home >> Lists Dec. 25, 2012   Lists Lists This is a new serie of articles here at Python for beginners, that are supposed to be a starting point for completely beginners of Python. See it as a cheat sheet, reference, manual or whatever you want. The purpose is to very short write down the basics of Python. This page will describe how to use lists in Python. What is a List? The simplest data structure in Python and is used to store a list of values. Lists are collections of items (strings, integers, or even other lists). Each item in the list has an assigned index value. Lists are enclosed in [ ] Each item in a list is separated by a comma Unlike strings, lists are mutable, which means they can be change...

Strings

String function in python Python  capitalize()  method converts first character of the string into uppercase without altering the whole string. It changes the first character only and skips rest of the string unchanged. Signature 1.     capitalize()   Parameters No parameter is required. Return Type It returns a modified string. # Python capitalize() function example   # Variable declaration   str =  "welcome"    # Calling function   str2 = str.capitalize()   # Displaying result   print( "Old value:" , str)   print( "New value:" , str2)  output: Old value: welcome New value: Welcome Python String Casefold() Method Python  Casefold()  method returns a lowercase copy of the string. It is more simillar to lowercase method except it re...