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
Given two objects represented by the tuples (22, 1, 42, 10) and (20, 0, 36, 8):
Rudik [331]

Answer:

Given,

P = (22, 1, 42, 10)

Q = (20, 0, 36, 8)

a. Formula for Euclidean Distance :

distance = ((p1-q1)^2 + (p2-q2)^2 + ... + (pn-qn)^2)^(1/2)

Now,

distance = ( (22-20)^2 + (1-0)^2 + (42 - 36)^2 + (10-8)^2) ) ^(1/2)

=( (2)^2 + (1)^2 + (6)^2 + (2)^2 ) ) ^(1/2)

=(4+1+36+4)^(1/2)

=45^(1/2)

Distance = 6.7082

b.Manhattan distance :

d = |x1 - x2| + |y1 - y2|

d = |22- 20| + |1 - 0|

d = |2| + |1|

Explanation:

4 0
2 years ago
The action in which a router divides and forwards incoming or outbound message traffic to multiple links is known as
kipiarov [429]
Load balancing is my best guess.
5 0
3 years ago
The______for our newest game keeps changing as we develop our concept and refine our goals.
antiseptic1488 [7]
I think d is the best here
6 0
3 years ago
Read 2 more answers
Hydraulic pressure is the same throughout the inside of a set of brake lines. What determines the amount of resulting mechanical
cestrela7 [59]

Answer: 1000 square ponds of force hope you know the answer

Explanation: i guessed

7 0
3 years ago
__________Is a software primarily used for creation of documents such as letters and reports
babunello [35]
Answer: word processing

hope this helps :)
8 0
2 years ago
Read 2 more answers
Other questions:
  • Write a script named numberlines.py. This script creates a program listing from a source program. This script should: Prompt the
    7·1 answer
  • When powering off your computer is best down using?
    8·2 answers
  • Someone help ASAP! Match the type of information system with its description.
    13·2 answers
  • If data from a DOS system is electronically sent to an EHR or other Windows-based system via an interface to populate an indexed
    7·1 answer
  • 1. Would it be possible for two people to have the same email address? Explain.
    9·2 answers
  • Describe the different
    12·1 answer
  • 2.13 LAB: Branches: Leap Year
    11·1 answer
  • Importance of type casting in programming ​
    5·1 answer
  • It is usually simple to delete old posts and online conversations if they make you look bad.
    5·1 answer
  • A nested folder can best be described as what?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!