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
Mama L [17]
3 years ago
13

A bit shift is a procedure whereby the bits in a bit string are moved to the left or to the right.

Computers and Technology
1 answer:
Deffense [45]3 years ago
8 1

Answer:

Following are the code to this question:

Defining method shiftLeft:

def shiftLeft(bit_string): #defining method shiftLeft, that accepts parameter bit_string

   bit_string= bit_string[1:]+bit_string[0]#use bit_string to provide slicing

   return bit_string#return bit_string value

bit_string =input("Enter value: ")#defining bit_string variable for user input

print (shiftLeft(bit_string))#use print method to call shiftLeft method

Defining method shiftRight:

def shiftRight(bit_string):#defining method shiftRight, which accepts bit_string variable

bit_string=bit_string[len(bit_string)-1]+bit_string[0:len(bit_string)-1]#using bit_string variable for slicing

   return bit_string#return bit_string calculated value

bit_string= input("Enter value: ")#defining bit_string variable for user input

print(shiftRight(bit_string))#use print method to call shiftLeft method

Output:

Please find the attachment.

Explanation:

method description:

  • In the above-given python code two methods "shiftLeft and shiftRight" are declared, in which both the method accepts a string variable "bit_string".
  • Inside methods, we use the slicing, in which it provides to use all the sequence values and calculated the value in this variable and return its value.  
  • At the last step, the bit_string variable is used to input value from the user end and call the method to print its value.

You might be interested in
Where does cable termination occur in most buildings?
Igoryamba

Answer:

Demarcation point

Explanation:

There is point that is set by engineers for the entrance of the cables to provide different services such as Telephone, internet and other utilities. At this point a device has been installed, in which service provider and end users plugin their cables.

Service providers is responsible for any service degradation till this point. After this point user is responsible for any damage. This point is called Demarcation point .

6 0
3 years ago
Computer operates nearly 100% accurately but why is the phrase'garbage in garbage out'(GIGO) associated with their use?Describe
k0ka [10]

Answer:

A program gives inaccurate results due to inaccurate data provided because a computer will always attempt to process data given to it. Said another way, the output quality of a system usually can't be any better than than the quality of inputs.

Explanation:

Techopedia Explains Garbage In, Garbage Out (GIGO)

<h3>Mark me a brainlist</h3>
8 0
3 years ago
The following program calculates yearly and monthly salary given an hourly wage. The program assumes a work-hours-per-week of 40
irina [24]

Answer:

The program implemented in Python is as follows:

hourly=float(input("Hourly Wage: "))

print("Annual Rate: "+str(hourly * 40 * 50))

print("Monthly Rate: "+str(round((hourly * 40 * 50/12),2)))

Explanation:

The question is incomplete as the missing code is not given. However, I've written the program from scratch in python.

This prompts the program user for the hourly Wage;

hourly=float(input("Hourly Wage: "))

This calculates and prints the annual rate

print("Annual Rate: "+str(hourly * 40 * 50))

This calculates and prints the monthly rate

print("Monthly Rate: "+str(round((hourly * 40 * 50/12),2)))

<u>Note:</u>

<em>The annual rate is calculated by multiplying the hourly wage to number of hours per week (40) to number of weeks per year (50)</em>

<em />

<em>The monthly rate is calculated by </em>annual\ rate/12<em />

5 0
3 years ago
Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consisting of a single positive in
Reika [66]

Answer:

see explaination for program code

Explanation:

scalar_product = 0

li=[]

li2=[]

#reading numbers1.txt and numbers2.txt intoli and li2 respectively

with open('numbers1.txt') as n1, open('numbers2.txt') as n2:

for line1 in n1:

li.append(int(line1))

for line2 in n2:

li2.append(int(line2))

#storing min list size into variable l

a=len(li)

b=len(li2)

if a<b:

l=a

else:

l=b

#calculating scalar product

for i in range(l):

scalar_product=scalar_product+li[i]*li2[i]

print("scalar product is",scalar_product)

6 0
4 years ago
Which guideline should you follow when selecting the font for a presentation?
diamong [38]
Most teachers prefer you to use Arial or Times New Roman
3 0
4 years ago
Other questions:
  • Which structure is sometimes called the "gateway to memory"?
    14·1 answer
  • You need to set up a network that needs to span multibple buildings. For this reason, you want to use the cabling that supports
    10·1 answer
  • What type of microscope requires a nonmetal sample to be prepared for viewing by coating it with a thin layer of a conductive ma
    9·2 answers
  • What is true about investments and risk
    14·1 answer
  • 3. Using your knowledge of how an ATM is used, develop a set of use cases that could serve as a basis for understanding the requ
    9·1 answer
  • A computer is performing a binary search on the sorted list of 7 numbers below.
    10·2 answers
  • Assignment 4: Evens and Odds
    9·1 answer
  • These operating systems use a graphical user interface.
    8·1 answer
  • Why do relational databases use primary keys and foreign keys?.
    12·1 answer
  • Which of these are correctly formatted python lists? check all that apply. list1=(race, cars, trucks, bikes) list2=[‘computer sc
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!