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
natta225 [31]
3 years ago
8

Write the function lettersOnly(s) that takes in a string called s, and returns a string containing only the alphabetic character

s of s.
Computers and Technology
1 answer:
Phantasy [73]3 years ago
4 0

Answer:

The program to this question as follows:

Program:

def lettersOnly(s): #defining method lettersOnly

   val="" #defining string variable that return value

   for i in s: #defining loop to calculate value

       if(i.isalpha()): #check condition that value is string

           val=val+ i #add value

   return val #return value

print(lettersOnly("data3base_ro1c3k5s")) #call method and print value

Output:

databaserocks

Explanation:

In the above python code, a method lettersOnly is declared that accepts a string variable  "s" in its parameter. Inside the method, a string variable "val", and loop is declared, in which the "val" variable holds method return value.

  • In the loop and if block is used that uses "isalpha" string method, which checks the check alphabetic character in the given value. if this is true it will calculate all value in "val" variable and return its value.    
  • At the last, the print method is used, which calls the lettersOnly method and prints its return value.
You might be interested in
for java ?(Business: check ISBN-13)ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d1
ludmilkaskok [199]

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 String isbn;

 System.out.print("First 1:2 digits: ");

 isbn = input.nextLine();

 if(isbn.length()==12){

 int chksum = 0;

 for(int i = 0; i<12;i++){

     if((i+1)%2==0){      chksum+= 3 * Character.getNumericValue(isbn.charAt(i));          }

     else{          chksum+=Character.getNumericValue(isbn.charAt(i));          }  }

 chksum%=10;

 chksum=10-chksum;

 if(chksum==10){

 System.out.print("The ISBN-13 number is "+isbn+"0");}

 else{

 System.out.print("The ISBN-13 number is "+isbn+""+chksum);          }   }

 else{

     System.out.print("Invalid Input");

 }     }}

Explanation:

See attachment for explanation where comments are used to explain each line

Download txt
6 0
3 years ago
Which one of the following oscilloscope controls is used to move the trace up and down the screen vertically? A. Focus B. Sweep
irga5000 [103]
The answer is A Focus hope it helps
7 0
2 years ago
Read 2 more answers
What are some of the academic benefits of a later start time that Jordan mentions​
maksim [4K]

Answer:

students will be more attentive and active

Explanation:

4 0
3 years ago
Which device or software application detects errors in system configurations?
Flura [38]
The answer of this question is bios software applications it detects errors in system configuration?
6 0
3 years ago
You're setting up offline conversion tracking. You need to to upload offline data into your Google Ads account. Which two format
ikadub [295]

Answer:

The two formats supported are C. Google sheets and D. CSV

Explanation:

Google Sheets, CSV (Comma Separated Value) files and Excel files are accepted for upload in the google ads account. To upload files,

  1. go to conversions and click on uploads (should be found on the left sidebar).
  2. Look for the + (plus) sign to begin your upload.
  3. Locate the location of the documents either on your local computer or sync with google sheets.
  4. Once the upload is complete, click the preview button to check the uploaded data to see it if it correct.
  5. As soon as you are satisfied, click on Apply to sync your data to your google ads account.
8 0
3 years ago
Other questions:
  • For homework, we have to figure out what's in the picture. It's " too close to tell " but I can't figure out what it is. Any ide
    11·1 answer
  • Which statement best explains taxation without representation was a major issue for colonists?
    12·1 answer
  • A(n) _____ might be written by a programmer or it might be created through a DBMS utility program.
    6·1 answer
  • How will using ascending order on a field that contains dates sort a list?
    12·2 answers
  • The standing toe touch is most likely to result in
    15·1 answer
  • Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
    5·1 answer
  • To create a formula in. . You would first click in one of the cells
    12·2 answers
  • Cuando se creo argentina​
    11·1 answer
  • A person who creates a computer virus is a (1)system analyst (2) techician(3) programmer​
    11·2 answers
  • if someone has become very attached to their mobile device and feels anxious if the cannot connect to the internet, what are the
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!