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
SashulF [63]
2 years ago
9

Use python

Computers and Technology
1 answer:
Degger [83]2 years ago
3 0

Answer:

def rec_dig_sum( num ):

   num_list = [ digit for digit in str(num)]

   total = 0

   for x in num_list:

       total += x

   return total

def dict_of_rec_dig_sums(low, high):

   mydict = dict()

   for number in the range(low, high+1):

      mydict[rec_dig_sum(number)] = number

   return mydict

Explanation:

The python program defines two functions, "rec_dig_sum" and "dict_of_rec_dig_sums". The former accepts a number and returns the sum of the digits of the number while the latter accepts a low and high number range.

The program returns a dictionary with the recursive sum as the keys and the number count as the values.

You might be interested in
A field whose data type is ____ can store text that can be used as a hyperlink address
olya-2409 [2.1K]
A field whose data type is URL address data can store text that can be used as a hyperlink address.
8 0
3 years ago
• R7.9 Write enhanced for loops for the following tasks.
alexdok [17]

Answer:

a is the correct answer

Explanation:

correct me if I'm wrong hope it's help thanks

3 0
2 years ago
write an algorithm that reads to values, determines the largest value and prints the largest value with an identifying message ​
REY [17]

Answer:

I'm unsure of what language you are referring to, but the explanation below is in Python.

Explanation:

a = int(input("Input your first number: "))

b = int(input("Input your second number: "))  

c = int(input("Input your third number: "))

maximum = max(a, b, c)

print("The largest value: ", maximum)

6 0
2 years ago
Suppose that you are asked to modify the Stack class to add a new operation max() that returns the current maximum of the stack
Advocard [28]

Answer:

Following are the code to the given points:

Explanation:

For point 8.1:

public String max()//defining a method max

{

   String maxVal=null;//defining a string variable that holds a value

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

   {

       if(maxVal==null || a[i].compareTo(maxVal)>0)//defining if blok to comare the value

       {

           maxVal=a[i];//holding value in maxVal variable

       }

   }

   return maxVal;//return maxVal variable value

}

For point 8.2:

public void push(String item)//defining a method push that accepts item value in a parameter

{

       a[n]=item;//defining an array to hold item value

       if(n==0 || item.compareTo(maxVals[n-1])>0)//use if to comare item value

       {

               maxVals[n]=item;//holding item value in maxVals variable

       }

       else

       {

               maxVals[n]=maxVals[n-1];//decreasing the maxVals value

       }

       n++;//incrementing n value

}

public String pop()//defining a method pop

{

       return a[--n];//use return value

}

public String max()//defining a method max

{

       return maxVals[n-1];//return max value

}

  • In the first point, the max method is declared that compares the string and returns its max value.
  • In the second point, the push, pop, and max method are declared that works with their respective names like insert, remove and find max and after that, they return its value.
7 0
3 years ago
Why do people yeet yeet and ree
DiKsa [7]

Answer:

Cause they are trying to be annoying

Explanation:

Something is wrong with them :)

8 0
2 years ago
Read 2 more answers
Other questions:
  • Days of the week are represented as three-letter strings ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"). Write a javaScript f
    14·1 answer
  • You have found statistics on the Internet that you would like to use in your speech.
    6·1 answer
  • A _________ is a copy of one or more files (or entire storage devices) that is made in case the originals become lost or damaged
    5·1 answer
  • A class defined by a user (i.e., you, the programmer programmer) ... Group of answer choices might contain no data members -- on
    13·1 answer
  • T F The exit function can only be called from main .
    10·1 answer
  • The method for updating the main memory as soon as a word is removed from the cache is called
    10·1 answer
  • doubleIt is a function that takes one argument and returns no value . The argument is a pointer to int . The function doubles th
    9·1 answer
  • Which type of document should Omar print?
    5·2 answers
  • Dropbox and Microsoft's OneDrive are both popular applications for storing files. What is a fundamental difference between Dropb
    15·1 answer
  • to provide for ecmascript compatibility in older browsers, you can use group of answer choices javascript shivs javascript shims
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!