Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
20 views

Programming With Python: Input Function

The document discusses various functions and methods used for string manipulation, data types, conditional statements, and loops in Python including comments, ASCII values, length, find, replace, strip, slicing, reversing, input, if/else, for loops, lists, sorting, inserting, removing and deleting elements.

Uploaded by

Tj harsh
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Programming With Python: Input Function

The document discusses various functions and methods used for string manipulation, data types, conditional statements, and loops in Python including comments, ASCII values, length, find, replace, strip, slicing, reversing, input, if/else, for loops, lists, sorting, inserting, removing and deleting elements.

Uploaded by

Tj harsh
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Programming with Python

• Statements with # charecter is considered as single line comments


• ord() function is used to find out the ASCII value of any charecter
• chr() function is used to find out the charecter present in any ASCII value
• len() function is used to know the length of a string
• max() function finds the charecter having maximum ASCII value
• min() function finds the charecter having minimum ASCII value
• find function finds the substring in the main string
• upper() or lower() functions is used to convert the string from upper case to lower case or vice-versa.
• replace function replaces a substring with required substring in the mainstring.
• strip function removes unwanted spaces in the given string. It has specifically lstrip for left strip and rstrip for right strip.
• stringname[start index : end index] function performs slicing operation and views only the sliced string.
• Stringname[::-1] performs reversing operation.

Input function :
• variable_name=input()

CONDITIONAL STATEMENTS :
• if(condition):
• else(condition):
• elif(condition):

LOOPING :
• for variable in range(range)

• declaring a list [//array] : y=list() or listname=[ ]


• to input values into a list : listname.append(element)
• listname.pop() to delete last element from the list
• direct initializaton : a[1, 2, 3, 4, 5 , 6]
• listname.sort() : sorts the list in ascending order
• listname.insert(position,element) inserts the element in the specified position
• listname.remove(element) removes the specified value. If the element is not present, it displays that the specified data is not in the
list.
• del list[range] deletes the data present in given range
• listname.sort(reverse=True) sorts the list in reverse order

You might also like