Creation and use of lists in Python
Creation and use of ranges in Python
On this mastery I’ll show you what are strings and how to use them in C++.
String are things that are represented by a sequence of characters.
We will create a function that works as a palindrome and tells the user if the word he input is a palindrome or not. Do as follows:
- Create a main program and leave a space before it for the function
- Create a function of type string called palindrome
- Condition the user input with VARIABLE.rbegin and VARIABLE.rend. This iterators make the string return reversed to the beginning and end. This is the Palindrome “function”
- In main(), ask the user for the input and call for the function.
Your program should look something like this:
Now let’s test it:
Great! Now you know how to do a basic program using string. If you want to learn more about strings, go to this webpage:
#Mastery25 A string means an ordered sequence of characters, and in most programming languages such strings are enclosed in either single or double quotes.
In C++ the enclosing delimiters are double quotes. IFor example, the usual first C++ program displays the string literal “Hello, world!” on the screen with the following output statement.
Strings are objects that represent characters, it is actually a one-dimensional array of characters. It is kind of like the same way you declare an array but instead you use characters. Which is the structure of a string?
char name[number of elements] ={‘a’, ‘b’, ‘c’};
or
char name[] ={“abc” };
You can represent a string the same way you represent an array.
1 |
2 |
3 |
a |
b |
c |
A standard library in C++ provides a string class type.
There are other ways to declare a different type of string.
Using namespace std;
String name;
Or
Std:: string name;
A string can be also assigned to each other or appended together using the + operator.
Strings can also be found as compsrisons…
One of the most confusing part of using char*s as strings is that comparisons tricky.
Here is a simple example of the usage of a string;
WATCH MY VIDEO https://youtu.be/jk3wQsbn3mk
96
Normal
0
21
false
false
false
ES-TRAD
X-NONE
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
table.MsoTableGrid
{mso-style-name:”Tabla con cuadrícula”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-priority:39;
mso-style-unhide:no;
border:solid windowtext 1.0pt;
mso-border-alt:solid windowtext .5pt;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-border-insideh:.5pt solid windowtext;
mso-border-insidev:.5pt solid windowtext;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
Mastery 23 – Creation and use of lists in Python Here’s WSQ10 in which I created and used a list. Mastery 25 – Creation and use of ranges in Python Here’s WSQ 14 in which is created and used a range in a for loop. You can algo assign it to a variable and use […]
This concept refers to the creation an use of strings in C++´.
Here’s my video explaining the concept: http://youtu.be/T4ig0fGOyOY?hd=1
Importing and using C++ libraries
Creation and use of strings in C++
I KNOW HOW TO USE RANGES IN PYTHON
HERE IS AN EXAMPLE WHERE I USE A RANGE IN PYTHON
Hey today we are going to learn how to create and use ranges in Pythons 3 : creating and using ranges #Mastery25
Here are masteries 23 and 25, about strings and vectors. Maybe the most complicated for me since I just learned how to use vectors. Enjoy: https://www.youtube.com/watch?v=llPuSsueAfY