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
List any 5 Unix commands with their brief description?
AlexFokin [52]

Answer:

Commands: commands are also known as "programs" and the program is a set of rules that performs a specific task which is executed by a computer.

Unix is an operating system. that supports multi-tasking and multi-user functionality. Unix is most widely used in all forms of computing systems such as desktop, laptop, and servers. It provides a Graphical user interface similar to windows.

The Unix operating system there are various commands. The list of five Unix commands can be given as:

1) cal

2) date

3) banner

4) who

5) whoami

1)cal:

The cal command stands for calender. It displays the date.

Syntax:

$ cal

or

$ cal [[month] year]

Example:

$ cal 10 2019

2)date:

The date command stands for date and time. It displays the system date and time.

Syntax:

$date

or

$ date[+format]

Example:

$ date +%d/%m/%y

3) banner

The banner command stands for display the text in to a large size.

Syntax:

$banner message

Example:

$banner Unix

4) who

The who command stands for display the list of users currently logged in.

Syntax:

$who

or

$who [option] … [file][arg1]

Example:

$who

5) whoami

The whoami command stands for display the user id of the currently logged-in user.

Syntax:

$whoami

Example:

$whoami

Explanation:

1)cal command display the current month and year.

2)date command display system date and time.

3)banner command display text in large size.

4)who command display the user name who currently login.

5)whoami command display user id.

4 0
3 years ago
An effective technology for e-training and e-learning is __________, which uses computer graphic displays that the user can adju
ruslelena [56]

Answer:d)Visual interactive simulation (VIS)

Explanation:Visual interactive simulation (VIS) is the technology that works in a system for its development and simulation application for making the system display dynamic.

The dynamic display is preferred because it creates the interest in clients and is also used for the e-learning purpose. It also helps in decision making in accordance with competitive process.

LOT, Flash and WebEx does not provide the  service for the e-teaching services with the dynamic display feature.Thus , the correct answer is option(d).

4 0
3 years ago
In general, WAN-specific standards identify specific security requirements for WAN devices. For example, the ___________________
allsm [11]

Answer:

WAN router security standard, Web services standard

Explanation:

Complete statement with blanks filled:

In general, WAN-specific standards identify specific security requirements for WAN devices. For example, the WAN router security standard explains the family of controls needed to secure the connection from the internal network to the WAN router, whereas the Web services standard identifies which controls are vital for use of Web services provided by suppliers and external partnerships.

7 0
2 years ago
Write a program that include a method that returns the sum of all the elements of a Linked List of Integers. Allow the user to e
Illusion [34]

Answer:

static void Main(string[] args)

       {

           //declare a blank linked list

           LinkedList<int> numList = new LinkedList<int>();

           Console.WriteLine("Enter the Numbers");

           //check if the size of the linkedlist is 10

           while(numList.Count < 10)

           {

               //read the input supplied by the user

               string val = Console.ReadLine();

               //check if the input is integer

               if(int.TryParse(val, out _) == false)

               {

                   //if not integer, display error message and prompt for new number

                   Console.WriteLine("Invalid number");

                   continue;

               }

               //add the inputted number to the linkedlist

               numList.AddLast(int.Parse(val));

               

           }

           //call the method for linkedlist sum and display it

           Console.WriteLine(SumLinkedList(numList));

           Console.Read();

       }

       //method for linkedlist summation

       private static int SumLinkedList(LinkedList<int> val)

       {

           //declare sum as zero

           int sum = 0;

           //loop through the linkedlist to display the num and sum all numbers

           foreach(int item in val)

           {

               Console.Write(item + " ");

               sum += item;

           }

           return sum;

       }

   }

Explanation:

program written with c#

8 0
2 years ago
Locker doors There are n lockers in a hallway, numbered sequentially from 1 to n. Initially, all the locker doors are closed. Yo
kow [346]

Answer:

// here is code in C++

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int n,no_open=0;

   cout<<"enter the number of lockers:";

   // read the number of lockers

   cin>>n;

   // initialize all lockers with 0, 0 for locked and 1 for open

   int lock[n]={};

   // toggle the locks

   // in each pass toggle every ith lock

   // if open close it and vice versa

   for(int i=1;i<=n;i++)

   {

       for(int a=0;a<n;a++)

       {

           if((a+1)%i==0)

           {

               if(lock[a]==0)

               lock[a]=1;

               else if(lock[a]==1)

               lock[a]=0;

           }

       }

   }

   cout<<"After last pass status of all locks:"<<endl;

   // print the status of all locks

   for(int x=0;x<n;x++)

   {

       if(lock[x]==0)

       {

           cout<<"lock "<<x+1<<" is close."<<endl;

       }

       else if(lock[x]==1)

       {

           cout<<"lock "<<x+1<<" is open."<<endl;

           // count the open locks

           no_open++;

       }

   }

   // print the open locks

   cout<<"total open locks are :"<<no_open<<endl;

return 0;

}

Explanation:

First read the number of lockers from user.Create an array of size n, and make all the locks closed.Then run a for loop to toggle locks.In pass i, toggle every ith lock.If lock is open then close it and vice versa.After the last pass print the status of each lock and print count of open locks.

Output:

enter the number of lockers:9

After last pass status of all locks:

lock 1 is open.

lock 2 is close.

lock 3 is close.

lock 4 is open.

lock 5 is close.

lock 6 is close.

lock 7 is close.

lock 8 is close.

lock 9 is open.

total open locks are :3

5 0
3 years ago
Other questions:
  • ASAP HELP NO GUESS A new pet store wants to design a logo to be displayed on business cards, posters in the shop’s windows, and
    9·2 answers
  • 4. The same data source can be used multiple times in creating mail-merge documents.
    7·1 answer
  • An enterprise system is a packaged software application that helps integrate various ___________ in a company.
    15·2 answers
  • Write a function called activity which takes an integer parameter X that does the following:
    6·1 answer
  • 1000base-t is a standard for achieving throughputs ____ times faster than fast ethernet over copper cable.
    8·1 answer
  • What is the final value for X ?<br><br> x= 1<br><br> x=13<br><br> x= x+3<br><br> x=0
    9·1 answer
  • Cryptcat is a Linux distribution that includes hundreds of security and hacking tools, including Nessus and Metasploit. It can p
    11·1 answer
  • If a file you are opening for appending does not exist, the operating system will detect the missing file and terminate the oper
    14·1 answer
  • What feature should be used before a document is printed
    8·1 answer
  • There are two main types of hard drive available to a computer. State what they are and describe their use.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!