Answer:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string st;
getline(cin,st);
int i=0;
while(i<st.length())
{
if(isupper(st[i]))
{
st.erase(st.begin()+i);
continue;
}
i++;
}
cout<<st<<endl;
return 0;
}
Explanation:
I have included the file bits/stdc++.h which include almost most of the header files necessary.
For taking the input as a string line getline is used.
For checking the upper case isupper() function is used. cctype header file contains this function.
For deleting the character erase function is used.
Answer:
readily available
Explanation:
The information needed to make this decision is readily available. That is because such decisions have been made countless times that strict guidelines have been created to handle any similar future decisions. These strict guidelines are organized as a sequence of events that must be followed accordingly and are always available for when the situation arises. Examples of this would be "What to do when a machine breaks?" or "What constitutes firing an employee?"
Answer:
Explanation:
The Python code that is provided in the question is correct just badly formatted. The snippet of code that states
return new_list
is badly indented and is being accidentally called inside the if statement. This is causing the function to end right after the first element on the list regardless of what type of data it is. In order for the code to work this line needs have the indentation removed so that it lines up with the for loop. like so... and you can see the correct output in the attached picture below.
def filter_only_certain_strings(data_list):
new_list = []
for data in data_list:
if type(data) == str and len(data) >= 5:
new_list.append(data)
return new_list