Strings
You're currently learning a lecture from the course:
...
Prerequisite Terminologies
In order to have thorough understanding of the main topic, you should have the basic concept of the following terms:
Duration:
Transcription
By:
Hamsa Ehsan
Introduction:
In Python, Strings are the consecutive collection of characters. A character is plainly a symbol. Strings are enclosed by either single quotation or double quotations. For Example, in Bioinformatics, DNA, RNA or protein are taken in as strings which are the sequences of nucleotides.
Steps:
Assigning to a Variable
Open the visual studio code.
Declare a variable and assign a string to it enclosed in single or double quotes.
Print that variable.
Go to ‘Debug’ and select ‘Run without debugging’.
It displays the string you assigned to that variable.
Without Assigning to a Variable
You can directly write the string in the print(“ ”) function without assigning it to a variable first.
Go to ‘Debug’ and select ‘Run without debugging’.
It displays the string you wrote in the parameter of Print function.
Built-in Functions With Strings
Just like print(“ ”) function, Strings can be used with any of Python’s built-in functions which can be accessed from Python Prompt.
For that, assign a string to a variable.
Call this variable with a dot ‘.’ operator proceeding with any built-in function from the Prompt.
You can assign this statement to a variable and print it or you can call it in print(“ ”) function directly.
Go to ‘Debug’ and select ‘Run without debugging’.
It displays the returned string from that function.
Syntax:
variableName = ‘string’
variable.function()
Summary:
In this video, we discussed strings in Python and how we can use them with different Python’s built-in functions such as .upper(), .lower(), .capitalize(), .replace(old, new) and those which can be helpful in Bioinformatics are .startswith(“ ”) and .endswith(“ ”).
File(s) Section
If a particular file is required for this video, and was discussed in the lecture, you can download it by clicking the button below.