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
Len [333]
4 years ago
14

Python

Computers and Technology
1 answer:
Lemur [1.5K]4 years ago
3 0

Answer:

#Program starts here

#Prompt User for Input "FirstName and LastName "

FirstName = input("Enter Your FirstName: ")

LastName = input("Enter Your LastName: ")

#Define Function

def lastF(FirstName, LastName):

     FirstName = FirstName[0]+"."

     print(LastName+", "+FirstName);

lastF(FirstName, LastName) #Call Function

#End of Program

Explanation:

On line 3 and 4, the user is expected to enter his/her first name and last name respectively

On line 6, the function LastF with two arguments is defines

On line 7, the initial of FirstName is extracted

Line 8 prints the required output

Line 9 Calls the defined function.

You might be interested in
One out of how many people in the world has a Fac3book account?
DanielleElmas [232]
Two highest maybe five
8 0
3 years ago
What is the computer?​
DiKsa [7]

Answer:

an electronic machine that can store, find and

8 0
3 years ago
How can netiquette help you communicate when texting or instant messaging?
Yanka [14]

1. D

2. C

it allows citizens to submit anonymous tips to the police

5 0
3 years ago
How many typefaces should you use in business documents?
Assoli18 [71]
It’s best to use two
5 0
3 years ago
Read 2 more answers
Write a method that accepts a String object as an argument and returns a copy of the string with the first character of each sen
emmainna [20.7K]

Answer:

The programming language is not stated; However, the program written in C++ is as follows: (See Attachment)

#include<iostream>

using namespace std;

string capt(string result)

{

result[0] = toupper(result[0]);

for(int i =0;i<result.length();i++){

 if(result[i]=='.' || result[i]=='?' ||result[i]=='!')  {

 if(result[i+1]==' ') {

  result[i+2] = toupper(result[i+2]);

 }

 if(result[i+2]==' ')  {

  result[i+3] = toupper(result[i+3]);

 }

 } }

return result;

}

int main(){

string sentence;

getline(cin,sentence);

cout<<capt(sentence);

return 0;

}

Explanation:

<em>The method to capitalize first letters of string starts here</em>

string capt(string result){

<em>This line capitalizes the first letter of the sentence</em>

result[0] = toupper(result[0]);

<em>This iteration iterates through each letter of the input sentence</em>

for(int i =0;i<result.length();i++){

This checks if the current character is a period (.), a question mark (?) or an exclamation mark (!)

if(result[i]=='.' || result[i]=='?' ||result[i]=='!')  {

 if(result[i+1]==' '){  ->This condition checks if the sentence is single spaced

  result[i+2] = toupper(result[i+2]);

-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized

 }

 if(result[i+2]==' '){ ->This condition checks if the sentence is double spaced

  result[i+3] = toupper(result[i+3]);

-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized

 }

}

}  <em>The iteration ends here</em>

return result;  ->The new string is returned here.

}

The main method starts here

int main(){

This declares a string variable named sentence

string sentence;

This gets the user input

getline(cin,sentence);

This passes the input string to the method defined above

cout<<capt(sentence);

return 0;

}

Download cpp
7 0
4 years ago
Other questions:
  • Mario wants to use computer.what is the first thing needs to know<br><br>​
    6·1 answer
  • A computer is presenting a user with a screen requesting payment before the user data is allowed to be accessed by the same user
    10·1 answer
  • Write a program that computes the minimum, maximum, average and standard deviation of the population over time for a borough (en
    6·1 answer
  • A vital step in maintaining an operating system is to regularly do what? Replace the hard drive. Organize the computer’s data. R
    11·2 answers
  • Whers the main characteristic of a Peer-to-peer (P2P) network?
    14·1 answer
  • An F-1 ____________ may be authorized by the DSO to participate in a curricular practical training program that is an__________
    8·1 answer
  • Accessing disk is much slower than accessing memory. As a result, many file systems have been designed with various optimization
    7·1 answer
  • WILL GIVE BRAINLIEST
    5·2 answers
  • How can using Prezi software for a presentation allow the presenter to better respond to audience needs?
    10·1 answer
  • The _______ displays the name of the open file and the program
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!