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
vagabundo [1.1K]
3 years ago
5

#Write a function called "in_parentheses" that accepts a

Computers and Technology
1 answer:
zimovet [89]3 years ago
8 0

Answer:

import regex as re

def in_parentheses(a_string):

   regeX = re.compile(".*?\((.*?)\)")

   result = re.findall(regeX, a_string)

   return str(result).replace("[","").replace("]","")

print("test 1: "+in_parentheses("Open ( only"))

print("test 2: "+in_parentheses("This is a sentence (words!)."))

You might be interested in
In this scenario, two friends are eating dinner at a restaurant. The bill comes in the amount of 47.28 dollars. The friends deci
pickupchik [31]

Answer:

The java program for the given scenario is as follows.

import java.util.*;

import java.lang.*;

public class Main

{

   //variables for bill and tip declared and initialized

   static double bill=47.28, tip=0.15;

   //variables for total bill and share declared

   static double total, share1;

public static void main(String[] args) {

    double total_tip= (bill*tip);

    //total bill computed

    total = bill + total_tip;

    //share of each friend computed

    share1 = total/2;

    System.out.printf("Each person needs to pay: $%.2f", share1);  

}

}

Explanation:

1. The variables to hold the bill and tip percent are declared as double and initialized with the given values.

static double bill=47.28, tip=0.15;

2. The variables to hold the values of total bill amount and total tip are declared as double.

3. All the variables are declared outside main() and at class level, hence declared as static.

4. Inside main(), the values of total tip, total bill and share of each person are computed as shown.

double total_tip= (bill*tip);

total = bill + total_tip;

share1 = total/2;

5. The share of each person is displayed to the user. The value is displayed with only two decimal places which is assured by %.2f format modifier. The number of decimal places required can be changed by changing the number, i.e. 2. This format is used with printf() and not with println() method.

System.out.printf("Each person needs to pay: $%.2f", share1);  

6. The program is not designed to take any user input.

7. The program can be tested for any value of bill and tip percent.

8. The whole code is put inside a class since java is a purely object-oriented language.

9. Only variables can be declared outside method, the logic is put inside a method in a purely object-oriented language.

10. As shown, the logic is put inside the main() method and only variables are declared outside the method.

11. Due to simplicity, the program consists of only one class.

12. The output is attached.

5 0
3 years ago
Read 2 more answers
There are numerous strict and steadfast rules when it comes to composition.
erastova [34]

Answer:

false

Explanation:

none ¯\_(ツ)_/¯

6 0
2 years ago
Which statement opens a text file so that you can retrieve the information it contains?
vesna_86 [32]

Answer:

Answered below

Explanation:

aFile = open("books.txt", "r")

This code uses the function open() which takes two parameters. The first parameter is the file name while the second parameter is the mode in which you are accessing the file.

The "r" mode opens the file in a reading state. That is, you can only read from the file. This code completes the reading process

aFile.read( )

The "w" mode opens the file so you can write to it and make changes.

The "a" mode opens the file so you can add contents to it.

3 0
2 years ago
Calculate the weighted grade for each student that appears in the data file. You may calculate the grade based on total earned p
lutik1710 [3]

Answer:

I don't know the answer, sorry

6 0
3 years ago
You can send emails to individuals from your address book.<br><br> True<br> False
MAXImum [283]
I believe the answer is False or I may be wrong
5 0
3 years ago
Other questions:
  • Ned and mary ann are saving their files to a cd
    15·1 answer
  • Thomas asked his friend for a software suite. His friend had the software suite in his computer and he copied it into a small, r
    11·1 answer
  • Can i still download an update for an xbox one game if it's not turned on
    13·1 answer
  • How do you run a function in python?
    5·1 answer
  • What could have made you redesign your plan? Select 3 options.
    6·1 answer
  • Are there any apps in the App Store that allow people to ask a question about any topic and have skilled professionals answer it
    6·1 answer
  • What is modern? explain​
    11·1 answer
  • Microsoft Word cannot be used to create personalized web<br> pages.<br> OTrue<br> False
    7·1 answer
  • Which insert image option allows a user to compile, modify, and add captions to images?
    5·2 answers
  • The cathode ray tube eventually was eventually used for what entertainment device?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!