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
adell [148]
3 years ago
5

In Python 3, write a decorator function that has the following property:

Computers and Technology
1 answer:
kicyunya [14]3 years ago
8 0

Answer:

Python code is explained below

Explanation:

# decorator.py starts

def uppercase(fcn):

def wrapper():

original = fcn;

modified = str(fcn).upper() ;

return modified;

return wrapper();

# decorator.py ends

# greet.py starts

import decorator  #to generate the decorator

def greetings():  #invokes the greetings function for output

print("Hello");

print(decorator.uppercase(greetings));

# greet.py ends

You might be interested in
What type of video surveillance is typically used by banks, casinos, airports, and military installations, and commonly employs
Nataly_w [17]
CCTV, ICTV, IPTV, ITV. These are all surveillance types. :))
3 0
3 years ago
Let $A = \{ a_1, . . . , a_n \}$ and $B = \{b_1, . . . , b_m\}$ be two sets of numbers. Consider the problem of finding their in
Digiron [165]
<h2>Answer: Pseudo code</h2>

Initialize intersection I as empty.

Find smaller of m and n and sort the smaller array.

function  printIntersection(int arr1[ ], int arr2[ ], int m, int n)  

{  

   // Before finding intersection, make sure arr1[0..m-1]  

   // is smaller  

   if (m > n)  

   {  

       int *tempp = arr1;  

       arr1 = arr2;  

       arr2 = tempp;  

 

       int temp = m;  

       m = n;  

       n = temp;  

   }  

 

   // Now arr1[ ] is smaller  

 

   // Sort smaller array arr1[0..m-1]  

   sort(arr1, arr1 + m);  

 

   // Search every element of bigger array in smaller  

   // array and print the element if found  

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

       if (binarySearch(arr1, 0, m-1, arr2[i]) != -1)  

           cout << arr2[i] << " ";  

}

3) For every element x of larger array, do following

…….b) Binary Search x in smaller array. If x is present, then copy it to I.

int binarySearch(int arr[], int l, int r, int x)  

{  

   if (r >= l)  

   {  

       int mid = l + (r - l)/2;  

 

       // If the element is present at the middle itself  

       if (arr[mid] == x)  return mid;  

 

       // If element is smaller than mid, then it can only  

       // be presen in left subarray  

       if (arr[mid] > x)  

         return binarySearch(arr, l, mid-1, x);  

 

       // Else the element can only be present in right subarray  

       return binarySearch(arr, mid+1, r, x);  

   }  

 

   // We reach here when element is not present in array  

   return -1;  

}

4) Return I.

Explanation:

Time complexity of this method is min(mLogm + nLogm, mLogn + nLogn) which can also be written as O((m+n)Logm, (m+n)Logn). This approach works better than the different approaches like hashing when difference between sizes of two arrays is significant.

6 0
3 years ago
Which of the following is not an operating system
mrs_skeptik [129]

Answer:

C

Explanation:

I hope this helped.

3 0
4 years ago
Read 2 more answers
The manager of Fitness Health Club wants a program that allows her to enter the number of calories and grams of fat contained in
liberstina [14]

Answer:

Explanation:

Below is the code used to carry out this problem, i hope you try it out and apply it to other similar problems.

Code to Copy:

Public Class myFatCalculator

'calculating fat

Private Sub btnCalculateFat_Click(sender As Object, e As EventArgs) Handles btnCalculateFat.Click

    Dim totCalories As Integer

    Dim grams As Decimal

    Dim fatCalories As Decimal

    Dim fatPercentage As Decimal

   

    Integer.TryParse(txtTotCalories.Text,totCalories)

    Decimal.TryParse(txtGrams.Text, grams);

    fatCalories=grams*9

    fatPercentage=fatCalories/totCalories*100;

    lblFatCalories.Text=fatCalories.ToString()

    lblFatPercentage.Text=fatPercentage.ToString("N0")

End Sub

'Clear all text boxes & labels

Private Sub btnClearForm_Click(sender As Object, e As EventArgs)Handles btnClearFrom_Click

    txtTotCalories.Clear()

    txtTotCalories.Clear()

    lblFatCalories.Clear()

    lblFatPercentage.Clear() ‘clear labels

End Sub

'Exit from the Application

Private Sub btnExitApp_Click(sender As Object, e As EventArgs)Handles btnExitApp_Click

    Application.Exit()

End Sub

'class ends

End Class

Coding:

Public Class myFatCalculator

'calculating fat

Private Sub btnCalculateFat_Click(sender As Object, e As EventArgs) Handles btnCalculateFat.Click

    Dim totCalories As Integer

    Dim grams As Decimal

    Dim fatCalories As Decimal

    Dim fatPercentage As Decimal

   

    Integer.TryParse(txtTotCalories.Text,totCalories)

    Decimal.TryParse(txtGrams.Text, grams);

    fatCalories=grams*9

    fatPercentage=fatCalories/totCalories*100;

    lblFatCalories.Text=fatCalories.ToString()

    lblFatPercentage.Text=fatPercentage.ToString("N0")

End Sub

'Clear all text boxes & labels

Private Sub btnClearForm_Click(sender As Object, e As EventArgs)Handles btnClearFrom_Click

    txtTotCalories.Clear()

    txtTotCalories.Clear()

    lblFatCalories.Clear()

    lblFatPercentage.Clear() ‘clear labels

End Sub

'Exit from the Application

Private Sub btnExitApp_Click(sender As Object, e As EventArgs)Handles btnExitApp_Click

    Application.Exit()

End Sub

'class ends

End Class

cheers i hope this helped !!!!

3 0
3 years ago
how do business activities in Vietnam differ from those in other countries? What cultural factors affect business activities in
Vedmedyk [2.9K]
Compared with other countries, doing business with Vietnamese people is comes in mixed traditional and modern type. Those who would like to do business in Vietnam should study how they do good business with them.

Based on the experiences written on Principles of Business, business cards <span>should be given at the same time</span>. It is considered a polite action when the business card presented to them is written in both languages. The Vietnamese language should be facing up. <span>Exotic food is served during the meal while small drinks should be taken. They do not want conversations to be in a fast-phase. Talk in a low voice.</span>


<span>Source: Principles of Business</span><span>By Les Dlabay, James L. Burrow, Brad Kleindl</span>
4 0
4 years ago
Other questions:
  • 1. Power tools are tools that use:
    10·2 answers
  • Select the correct answer from the drop-down menu. Which two technologies support the building of single-page applications? and
    11·1 answer
  • If a linux installation ends abnormally and the screen displays a fatal signal 11 error, what type of error has occurred?
    7·1 answer
  • Technology that is attached to a tag and used to identify postal packages is a(n) _____.
    12·2 answers
  • Linda is a core member of a project. She estimates the cost of the project, creates project requirements, and notes risks. What
    13·1 answer
  • PreparedStatement ps = connection.prepareStatement("select firstName, mi, lastName from Student where lastName = ?"; ps.setStrin
    13·1 answer
  • If E=mc2 then what does F equal?
    10·1 answer
  • Create a function that takes a list of numbers between 1 and 10 (excluding one number)
    8·1 answer
  • To access documents stored on a "cloud", you'll
    12·1 answer
  • SummaryIn this lab, you complete a partially prewritten Java program that uses an array.The program prompts the user to interact
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!