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
vitfil [10]
3 years ago
13

The permissions of a file in a Linux system are split into three sets of three permissions: read, write, and execute for the own

er, group, and others. Each of the three values can be expressed as an octal number summing each permission, with 4 corresponding to read, 2 to write, and 1 to execute. Or it can be written with a string using the letters r, w, and x or - when the permission is not granted. For example: 640 is read/write for the owner, read for the group, and no permissions for the others; converted to a string, it would be: "rw-r-----" 755 is read/write/execute for the owner, and read/execute for group and others; converted to a string, it would be: "rwxr-xr-x" Fill in the blanks to make the code convert a permission in octal format into a string format. ?? python code
Computers and Technology
1 answer:
Reptile [31]3 years ago
7 0

Answer:

Explanation:

def octal_to_string(octal):

   result = ''

   value_letters = [(4, 'r'), (2, 'w'), (1, 'x')]

   for c in [int(n) for n in str(octal)]:

       for value, letter in value_letters:

           if c >= value:

               result += letter

               c -= value

           else:

               result += '-'

   return result

print(octal_to_string(755))

print(octal_to_string(644))

print(octal_to_string(750))

print(octal_to_string(600))

**************************************************

You might be interested in
the first day anna read a quarter of the book. on the second day she read a third of the remainder. noticed that after two days
Misha Larkins [42]

Answer:

160 pages

Explanation:

Day\ 1 = \frac{1}{4}

Day\ 2 = \frac{1}{3}Remainder

Left = 80

Required

The number of pages

Let the number of pages be x.

So, on day 1; we have:

Day\ 1 = \frac{1}{4}x

After day 1, there are:\frac{3}{4}x left ----------------- i.e x - 1/4x

On day 2, we have:

Day\ 2 = \frac{1}{3} * \frac{3}{4}x

Day\ 2 = \frac{1}{4}x

At this point, we have:

Day\ 1 = \frac{1}{4}x

Day\ 2 = \frac{1}{4}x

Left = 80 ---- pages left

The summation of all must equal x, the book pages

Day\ 1 + Day\ 2 + Left = Total\\

\frac{1}{4}x + \frac{1}{4}x+ 80= x

Simplify the left-hand side

\frac{1}{2}x+ 80= x

Collect like terms

x - \frac{1}{2}x= 80

Simplify

\frac{2-1}{2}x= 80

\frac{1}{2}x= 80

Multiply by 2

2 * \frac{1}{2}x= 80*2

x = 160

4 0
3 years ago
Write an expression to print each price in stock_prices. Sample output with inputs: 34.62 76.30 85.05
Lana71 [14]

Answer:

Here is the Python program:

stock_prices = input().split() #to take input and splits it into a list

for price in stock_prices: #iterates through stock_prices

   print("$",price) #prints each value of stock_prices with a dollar sign

Explanation:

The program is well explained in the attached comments. I will explain the logic of the program with the help of an example:

Suppose the user enters the following input as stock_prices values

34.62 76.30 85.05

input() method is used to take input from user

split() method is used to split or break this input string and returns a list of strings as:

['34.62', '76.30', '85.05']    

Now the statement for price in stock_prices: iterates through each item of the list and print("$",price) prints each value of list with a dollar sign on the output screen as:

$ 34.62                                                                                                            

$ 76.30                                                                                                            

$ 85.05    

4 0
4 years ago
I re-made the human version of Daddy Dearest from Friday Night Funkin
schepotkina [342]
I like the second one better xx
6 0
3 years ago
Read 2 more answers
How many base cases are in the functionabove?
baherus [9]

Answer:

The answer is (b). 1.

Explanation:

In the code there is only 1 base case .

the base case is as following:-

if(n==0)

return 0;

this is the base case.

Base case is the most important statement in the function that uses recursion because without base case the recursion calls will keep on going and we will get a run time error.

5 0
3 years ago
During the software planning process, Rick, a project manager, finds that his team has made an incorrect estimation of funds. Wh
allochka39001 [22]

Answer:

Rick has identified a cost risk.

Explanation:

Risk is the probability of loss in a given setting. Herein, the risk involved is the inadequate assessment of the costs involved to carry out the project usually as a result of poor pricing evaluation of resources required for the project. At the early stage of every project, effective and efficient cost estimation is needed because it provides a basis for estimation of the total costs, it helps distribute the cost budget, it eases decision making and thereby assuring a level of profitability, everything being equal.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Network id is 192.168.10.32/28. what would be the ip address, if you assign the last available ip address in the range
    14·2 answers
  • Excel has more than 400 additional functions that perform just about every type of calculation you can imagine. Answer
    6·1 answer
  • Give several reasons why Python is such a great programming language. Explain how Python is related to flowcharts. (students mak
    9·1 answer
  • Which philosopher believed that if we carefully examine the contents of our experience, we find that there are only two distinct
    10·1 answer
  • Visual-verbal synergy has nothing to do with text, but solely with images used in a design.
    9·1 answer
  • What is the command for basic router configuration?
    6·1 answer
  • New friends??? if you want to be my new friend go follow my gram
    7·2 answers
  • CLI is not used friendly ​
    15·1 answer
  • A presentation software that is used to organize and present pertinent information using graphics, word processing, outlining, d
    12·1 answer
  • Assume that two students are trying to register for a course in which there is only one open seat. What component of a database
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!