Answer:
Expression for 1st option:
last_character=name[len(name)-1]
print(last_character)
Expression for 2rd option:
length_of_the_string=len(sentence)
print(length_of_the_string)
or
length=0
for x in sentence:
length=length+1
print(length)
Expression for 3rd option:
last_character=name[len(name)-1]
print(last_character)
Explanation:
- The first and the third questions option are same, so the answer to those options are also the same.
- The len function is used in python which is used to find the length of the string.
- The user can also find the string length by the help second option which is written in option 2 answers. It uses a for loop which scans the character and counts the length.
- The len function defines the length and if any user needs to print the last character then he can do it with the help of string size -1.
- It is because the string is a collection of character array which index starts from 0 and ends in size-1.
Answer:
Goggles
Explanation:
If a chemical splashes on goggles it on hurt you.
Answer:
In C++:
#include<iostream>
#include<vector>
using namespace std;
int main() {
int len;
cout<<"Length: "; cin>>len;
string inpt;
vector<string> vect;
for(int i =0;i<len;i++){
cin>>inpt;
vect.push_back(inpt); }
char ch;
cout<<"Input char: "; cin>>ch;
for(int i =0;i<len;i++){
size_t found = vect.at(i).find(ch);
if (found != string::npos){
cout<<vect.at(i)<<" ";
i++;
}
}
return 0;
}
Explanation:
This declares the length of vector as integer
int len;
This prompts the user for length
cout<<"Length: "; cin>>len;
This declares input as string
string inpt;
This declares string vector
vector<string> vect;
The following iteration gets input into the vector
for(int i =0;i<len;i++){
cin>>inpt;
vect.push_back(inpt); }
This declares ch as character
char ch;
This prompts the user for character
cout<<"Input char: "; cin>>ch;
The following iterates through the vector
for(int i =0;i<len;i++){
This checks if vector element contains the character
size_t found = vect.at(i).find(ch);
If found:
if (found != string::npos){
Print out the vector element
cout<<vect.at(i)<<" ";
And move to the next vector element
i++;
}
}
<span>The meaning of Joystick is the control column of an aircraft</span>
Answer: the right option is b
Explanation:
RS232 was originally introduced in 1960 and it was used to transmit signals using a positive voltage for binary 0 and negative voltage for binary 1.