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
Bends are made in pvc conduit using a tool known as a
USPshnik [31]
The answer is C) heater box
8 0
3 years ago
Read 2 more answers
Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines. Each line contains an a
anzhelika [568]

Answer:

words.hasNext()

Explanation:

Given the code snippet below:

  1.        while (inputFile.hasNextLine()) {
  2.            String word = "";
  3.            String line = inputFile.nextLine();
  4.            Scanner words = new Scanner(line);
  5.            while (words.hasNext()) {
  6.                word = words.next();
  7.            }
  8.            System.out.println(word); }
  9.    }

We have a inputFile Scanner object that can read data from a text file and we presume the inputFile has read several rows of data from the text file. So long as there is another line of input data available, the outer while loop will keep running. In each outer loop, one line of data will be read and assign to line variable (Line 3). Next, there is another Scanner object, words, which will take the current line of data as input. To get the last word of that line, we can use hasNext() method. This method will always return true if there is another tokens in its input. So the inner while loop will keep running so long as there is a token in current line of data and assign the current token to word variable. The word will hold the last token of current line of data upon exit from the inner loop. Then we can print the output (Line 8) which is the last word of the current line of data.

7 0
3 years ago
Which of the following statements best describes cell protection when it is first activated?
KiRa [710]

Answer:

A and C

Explanation:

7 0
3 years ago
Uso de las redes sociales como el uso de una impresora en casa se satisfacen estás tres etapas
Svetradugi [14.3K]

Question: what question is this?

7 0
2 years ago
Which of the following is NOT a cost typically associated with owning a car?
Arturiano [62]
A. fuel ; when you but a car you aren't buying the gas to go in it 
3 0
3 years ago
Other questions:
  • Match the job skills with the correct job role.
    12·1 answer
  • JavaScript
    10·1 answer
  • A _____ is an electronic path over which data can travel.
    15·1 answer
  • Excel assigns the name ____ to the first excel table created in a workbook.
    10·1 answer
  • ICS facilitates the ability to communicate by using:
    7·1 answer
  • PLS HELP QUICKLY!!!<br> Thank you
    7·2 answers
  • What is the point of brainy when other people have to answer your questions but not the cumputer
    9·1 answer
  • Help giving points mark BRAINLEST
    5·1 answer
  • ANYONE WANNA FRIEND ME ON DISCORD ゴRose joestarゴ#2088
    9·1 answer
  • What are the inputs that the model uses to make decisions?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!