1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PIT_PIT [208]
3 years ago
14

Write a method that accepts a string as an argument and checks it for proper capitalization and punctuation. The method should d

etermine if the string begins with an uppercase letter and ends with a punctuation mark. The method should return true if the string meets the criteria; otherwise it should return false .
Computers and Technology
1 answer:
Contact [7]3 years ago
6 0

Answer:

The method in Python is as follows:

def checkStr(strng):

   if strng[0].isupper() and strng[-1] == "?":

       return True

   else:

       return False

Explanation:

This defines the method

def checkStr(strng):

This checks if the first character i upper and if the last is "??

   if strng[0].isupper() and strng[-1] == "?":

If the condition is true, the function returns true

       return True

Else, it returns false

<em>    else:</em>

<em>        return False</em>

You might be interested in
Give one advantage and two disadvantages of using a wireless network
denis23 [38]
An advantage would be that you wouldn't  have to try to get cables from everywhere but the disadvantages are that you would loose internet while walking and you would have unstable internet. I'm sorry if I'm wrong
6 0
3 years ago
3. If the typical balance on Lucy's credit card is $750 and the interest rate (APR) on her credit card is 16%, how much in inter
oee [108]
Lucy will be charged about $10.00
8 0
3 years ago
Read 2 more answers
Write a Twitter class that sets the Twitter user first (who is to be followed) and lets the client add up to 5 followers, which
Rzqust [24]

Answer:

Twitter.h

========

#ifndef Twitter_h

#define Twitter_h

#include <iostream>

using std::string;

using std::cout;

using std::endl;

template <typename T>

class Twitter

{

private:

string name;

T followers[5];

int numFollowers;

public:

Twitter(string n);

bool AddFollower(T follower);

bool RemoveFollower(T follower);

void PrintFollowers();

};

template <typename T>

Twitter<T>::Twitter(string n)

{

name = n;

numFollowers = 0;

}

template <typename T>

bool Twitter<T>::AddFollower(T follower)

{

if(numFollowers < 5)

{

followers[numFollowers] = follower;

numFollowers++;

return true;

}

else

return false;

}

template <typename T>

bool Twitter<T>::RemoveFollower(T follower)

{

int index;

bool found = false;

for(index = 0; index < numFollowers; index++)

{

if(followers[index] == follower)

{

found = true;

break;

}

}

if(found)

{

//shift all other followers after the one to be removed to one position left

for(++index; index < numFollowers; ++index)

{

followers[index-1] = followers[index];

}

numFollowers--;

return true;

}

else

return false;

}

template <typename T>

void Twitter<T>::PrintFollowers()

{

cout << "Followers for " << name << endl;

for(int i = 0; i < numFollowers; i++)

cout << followers[i] << endl;

 

cout << "------" << endl << endl;

}

#endif /* Twitter_h */

main.cpp

=========

#include "Twitter.h"

#include <iostream>

using namespace std;

struct Profile {

string userName;

int age;

string state;

};

 

ostream& operator << (ostream & output, Profile p) {

output << p.userName;

return output;

}

bool operator == (const Profile &p1, const Profile p2)

{

return p1.userName == p2.userName;

}

int main()

{

Twitter<string> t1("John");

Twitter<Profile> t2("Bob");

 

cout << "Adding followers to John" << endl;

t1.AddFollower("Bill");

t1.AddFollower("Jack");

t1.PrintFollowers();

 

Profile p1 = {"Alice", 20, "Alaska"};

Profile p2 = {"Janet", 22, "California"};

Profile p3 = {"Jim", 20, "Texas"};

 

cout << "Adding follower profiles to Bob" << endl;

t2.AddFollower(p1);

t2.AddFollower(p2);

t2.AddFollower(p3);

t2.PrintFollowers();

 

cout << "Removing Bill from John" << endl;

t1.RemoveFollower("Bill");

 

cout << "Removing Janet's profile from Bob" << endl << endl;

t2.RemoveFollower(p2);

 

t1.PrintFollowers();

t2.PrintFollowers();

 

 

 

}

output

-======

Adding followers to John

Followers for John

Bill

Jack

------

Adding follower profiles to Bob

Followers for Bob

Alice

Janet

Jim

------

Removing Bill from John

Removing Janet's profile from Bob

Followers for John

Jack

------

Followers for Bob

Alice

Jim

------

Explanation:

4 0
3 years ago
Once you resize a photograph, it cannot be returned to its original size. TRUE or FALSE
VladimirAG [237]
I believe the answer is false

8 0
2 years ago
If you wanted to make certain numbers in a spreadsheet stand out, you should _____.
almond37 [142]
Make the numbers in bold and/or underlined
3 0
3 years ago
Read 2 more answers
Other questions:
  • Which of these statements best describes an application programming interface?
    5·1 answer
  • Scavenging is a form of fraud in which the perpetrator uses a computer program to search for key terms in a database and then st
    14·1 answer
  • Which technology can be used to protect the privacy rights of individuals and simultaneously allow organizations to analyze data
    13·1 answer
  • Instructions
    12·1 answer
  • A customer comes into a computer parts and service store. The customer is looking for a device to help a person with accessibili
    5·1 answer
  • Which statement will properly start the main() function? def main(): def Main def main# def main[]
    14·2 answers
  • How to format the selected range of cells as u.s currency
    6·1 answer
  • Which sentence in the passage shows an effective way to protect your document from misuse? Claire has saved her research paper o
    14·1 answer
  • How does Shakespeare immediately introduce Tybalt as a menacing character?
    9·1 answer
  • When you try to move the desktop icon using the click and drag method and it doesn't move, what is the reason?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!