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
timurjin [86]
3 years ago
14

Write a function called cipher(phrase,shift)that accepts two parameters: a string phrase and an integer shift.The integer shift

can be positive, negative or zero.

Computers and Technology
1 answer:
Aleks [24]3 years ago
7 0

Answer:

Following is given the code according to requirement.

The code is attached as an image so that the indentation is understood by the user. Comments are given inside the code where necessary.

The output of code is also attached as well  in end.

I hope it will help you!

Explanation:

You might be interested in
Define token. Give examples of 5 tokens in any programming language​
dimaraw [331]

<u>Tokens and its examples:</u>

Token is data type and it is behavior or categorized types. Basically most of programing language will have all five tokens data types and they are.

  • Operators.
  • Constants
  • Reserve words
  • Separators
  • Identifiers

Operators: - such as mathematic operations such as example: - “+”,”-“

Constants: - which used with CONST in vb.net or #define in c programming language, such as example: - 400,200.

Reserved words:- if , then are all used for if condition where if and then are reserved used in programming language for specific purpose.

Separators: - it used with write a procedure or function, in c languages “()” or “()” in vb.net sub and end sub.

Identifiers: - end user to define variable with data type class and store the value in the programming languages, such as amt = 0, rate=10.5.

8 0
3 years ago
The game begins with the player having 20 POINTS
kompoz [17]

Answer:

Following are the code to this question:

import random#import package for using random method  

def rolling_dice(): #defining method rolling_dice that uses a random number to calculate and add value in dice1 and dice2 variable

   dice1 = random.randint(1,6)

   dice2 = random.randint(1,6)

   return dice1 + dice2

def rolling(): # defining method rolling

   n_roll = 0  # defining num variable that initial value that is 0.

   p = 20 # defining variable p for looping, that points in between 1 and 59

   while p > 0 and p < 60: # defining loop that counts value dice value two times  

       d = rolling_dice()#defining d variable that hold method value

       n_roll+= 1 #defining n_roll that increment n_roll value by 1

       if d == 7 or d == 11:# defining if block that uses the d variable that checks either 7 or 11, player won d in p variable

           p+= d   # use p variable that adds d variable

       elif d == 2 or d == 3 or d == 12:#defining elif block to that checks d variable by using or operator  

           p-= d#defining d variable that decreases d variable variable

       else: # defining else block

           p1 = d # using p1 variable that store d value  

           while True:# defining loop that calculates values

               d = rolling_dice()#defining d variable that holds method values

               n_roll += 1 #increment the n_roll value by 1

               if d == 7:#defining if block that checks d value equal to 7

                   p -= p1#subtract the value of p1 in p variable  

                   break # exit loop

               elif d == p:#defining elif block to check d value is equal to p

                   p += p1#adds the value of p1 in p variable  

                   break#using break keyword

   if p<= 0:#defining if block that checks p-value is less then equal to 0  

       print('Player lost')#using print method

   elif p>= 60:#defining else block that checks p-value is greater than equal to 60

       print('Player won')#using print method to print the value

   print('number of dice rolls:', n_roll)#use print method to print n_rolls value

rolling()

Output:

Player lost

number of dice rolls: 38

Explanation:

In the above-given python code, a method "rolling_dice" is declared, inside the method two-variable "dice1 and dice2" is declared, that uses the random method to calculate the value in both variable and use the return keyword to add both values.

  • In the next step, another method the "rolling"  is declared, inside the method "n_roll and p" is declared that assigns the values and use the two while loop, inside the loop if block is defined that calculates the values.
  • In the next step, a condition block is used that stores value in the p variable and use the print method to print the "n_roll" value.  
8 0
3 years ago
Which of the following cannot be done from the windows task manager?
hodyreva [135]
The answer is (B) delete a program from the hard drive.

The task manager enables you to monitor processes, applications and services currently running on your computer. You can use it to start and stop programs and processes. In addition, you can use the task manager to show informative stats about your PC’s performance and network.
With this kind of information always listed at the bottom of the windows task manager, you will be able to know whether your computer is working hard or hardly working. To delete a program from the hard drive, you have to go to the control panel to uninstall an application properly.
5 0
3 years ago
Para que sirve un software
dedylja [7]
No habla muy espaniol?
6 0
3 years ago
West Point Bridge Designer | Does anyone know a way to make this bridge cost less?
e-lub [12.9K]
Make the zig zag part more spaced out
4 0
3 years ago
Other questions:
  • Discuss OPENGL instruction to draw the following drawing primatives:
    14·1 answer
  • Develop an sec (single error correction) code for a 16-bit data word. generate the code for the data word 0101000000111001. show
    6·2 answers
  • In general, font size for software-generated presentation slides should be no smaller than __________ points.
    8·1 answer
  • How do you validate the type of text that a user enters?
    7·1 answer
  • _is necessary for the health growth of bones and teeth fill ups​
    8·2 answers
  • Type the correct answer in the box. Spell all words correctly. Define the term semiconductor. A semiconductor is a material that
    9·1 answer
  • Which describes a design theme in PowerPoint? a set of elements that unify the slides and complement the topic a printed handout
    7·2 answers
  • Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (a
    14·1 answer
  • Why might the government censor what its citizens see on the internet?
    13·2 answers
  • Which Tab contains the paragraph attributes?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!