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
Nat2105 [25]
2 years ago
14

O

Computers and Technology
1 answer:
BaLLatris [955]2 years ago
3 0

The program written in python 3 which randomly removes one alphabet from a string and returns the new string is written thus:

import random

<em>#import</em><em> </em><em>the</em><em> </em><em>random</em><em> </em><em>module</em><em> </em>

def rand_minus(s):

<em>#initialize</em><em> </em><em>a</em><em> </em><em>function</em><em> </em><em>named</em><em> </em><em>rand_minus</em><em> </em><em>which</em><em> </em><em>takes</em><em> </em><em>on</em><em> </em><em>one</em><em> </em><em>parmaters</em><em>,</em><em> </em><em>which </em><em>is a</em><em> </em><em>string</em><em> </em>

minus_1 = random.sample(s, len(s)-1)

<em>#using</em><em> </em><em>the</em><em> </em><em>sample</em><em> </em><em>method</em><em> </em><em>in the</em><em> </em><em>random</em><em> </em><em>module</em><em>,</em><em> </em><em>randomly</em><em> </em><em>select</em><em> </em><em>alphabets</em><em> </em><em>which is</em><em> </em><em>one</em><em> </em><em>lesser</em><em> </em><em>than</em><em> </em><em>the</em><em> </em><em>number</em><em> </em><em>of</em><em> </em><em>alphabets</em><em> </em><em>passed</em><em> </em><em>in</em><em>.</em><em> </em>

new =''

<em>#initialize</em><em> </em><em>an</em><em> </em><em>empty</em><em> </em><em>string</em><em> </em><em>named</em><em> </em><em>new</em><em> </em>

for alp in minus_1:

<em>#loop</em><em> </em><em>through</em><em> </em><em>the</em><em> </em><em>randomly</em><em> </em><em>selected</em><em> </em><em>alphabets</em><em> </em><em>in the</em><em> </em><em>list</em><em> </em>

new+=alp

<em>#place</em><em> </em><em>each</em><em> </em><em>alphabet</em><em> </em><em>in</em><em> </em><em>the</em><em> </em><em>empty</em><em> </em><em>string</em><em> </em><em>created</em><em> </em>

return new

<em>#return</em><em> </em><em>the</em><em> </em><em>string</em><em> </em><em>in the</em><em> </em><em>new</em><em> </em><em>variable</em><em>.</em><em> </em>

<em>#</em><em> </em><em>A</em><em> </em><em>sample</em><em> </em><em>run</em><em> </em><em>of</em><em> </em><em>the</em><em> </em><em>program</em><em> </em><em>and</em><em> </em><em>its</em><em> </em><em>output</em><em> </em><em>are</em><em> </em><em>attached</em><em> </em><em>below</em><em>.</em><em> </em>

old = 'ABEFCD'

print(rand_minus(old))

Learn more :brainly.com/question/25210352

You might be interested in
Which data type is -7
bixtya [17]

Answer:

integer

Explanation:

4 0
3 years ago
What are the features of G-mail <br><br>(Write in your own words)​
wlad13 [49]

Answer:

here is what I think!

Explanation:

G-mail is:

  1. secure
  2. easy to use
  3. fast
  4. can be used to sign in anywhere!<u>(including brainly)</u>
  5. you don't need to pay when creating one
  6. can help you in billing and buying apps and their paid product
  7. <em><u>you </u></em> can use it because <em>why no!</em>
  8. some websites need G-mail to be used

thats why you should use G-mail

tell me if you have an idea!

3 0
3 years ago
Read 2 more answers
Web client software, such as Chrome, Firefox, Internet Explorer, Safari, and Opera, that are used to view Web pages are known as
evablogger [386]

Answer: Web Browsers

Explanation: The application software that works on the World Wide Web(www) is known as the web browser. Web browsers are the application must be installed on the user's system so that the accessing of the web server can be done.

There are different types of web browsers, out of which the most popular is Chrome and other examples are Internet Explorer, Opera, Firefox etc.

8 0
3 years ago
Read 2 more answers
According to the Modern Language Association (MLA) style guidelines, which citation is formatted correctly?
aalyn [17]
A) Marian Shelby. “The Fall of Rome.” Military Forces. n.p., 11 Mar 2009. Web.
14 Oct 2012.
4 0
4 years ago
Read 2 more answers
You have a large company, and it is important to your business that your employees' work is backed up regularly. Which network w
valkas [14]
Client server network as it has a powerful server which provides all the networks required on the network. Files are usually backed up regularly.

3 0
4 years ago
Other questions:
  • Write a class named Averager containing: An instance variable named sum of type integer, initialized to 0. An instance variable
    6·1 answer
  • a reviewer is required to enter a reason in the comments field only when a candidate is recommended to be hired. which action ca
    8·1 answer
  • For a loop counter, the appropriate data type would be:
    14·1 answer
  • What kind of security features does Microsoft Security Analyzer promise?
    5·1 answer
  • Software that gives network administrators the ability to provide computer assistance from a central location by allowing them t
    15·1 answer
  • Grooves and polished surfaces on desert pebbles are most likely caused by
    10·1 answer
  • Suppose a MATV/SMATV (Satellite Master Antenna Television) firm has to start it's operation in the metropolitan area of a countr
    12·1 answer
  • How can a smartphone's gyroscope and accelerometer be used in product marketing? A. to locate the user's geographical position B
    5·1 answer
  • Why was the tesla model s help change the was we see EV
    12·1 answer
  • Please choose odd one out please tell fast​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!