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
Deffense [45]
3 years ago
13

read a file called filled in with a few sentences or a paragraph. Then write a function called typoglycemia, which scrambles the

letters in the words in the file leaving the first and last characters unchanged and then writes the results to a new file called "scrambled.txt".Save the file
Engineering
1 answer:
sladkih [1.3K]3 years ago
7 0

Answer:

def typoglycemia():

import random

punct = (".", ";", "!", "?", ",")

count = 0

new_word = ""

inputfile = input("Enter input file name:")

with open(inputfile, 'r') as fin:

for line in fin.readlines(): #Read line by line in txt file

for word in line.split(): # Read word by word in each line

if len(word) > 3: # If word length >3

'''If word ends with punctuation, Remove first letter, last letter and punctuation

shuffle the words: Add the removed letters at their respective positions'''

if word.endswith(punct):

word1 = word[1:-2]

word1 = random.sample(word1, len(word1))

word1.insert(0, word[0])

word1.append(word[-2])

word1.append(word[-1])

''' If there is no punctuation mark: Remove first and last letter.

Shuffle the word then add removed letters at their respective position'''

else:

word1 = word[1:-1]

word1 = random.sample(word1, len(word1))

word1.insert(0, word[0])

word1.append(word[-1])

new_word = new_word + ''.join(word1) + " "

''' If word length <3, just append the word and " " to the the previous words'''

else:

new_word = new_word + word + " "

with open((inputfile[:-4] + "scrambled.txt), 'a+') as fout:

fout.write(new_word + "\n")

new_word = ""

You might be interested in
In Process Costing, the journal entry to record the cost of goods transferred out from the WIP shaping department to the WIP pac
ddd [48]

Answer:

Journal entry :

Date Account and explanation Debit credit

                WIP-Packing department XXX  

                WIP-Shaping department            XXX

(To record cost of goods transferred out from the WIP shaping department to the WIP packaging department )  

So above statement is False

Explanation:

4 0
3 years ago
A tool used to put a concave edge on a plane iron is
tigry1 [53]

Answer:

C) grinder

Explanation:

7 0
2 years ago
Read 2 more answers
Do a summary what happen to titanic in the aspect of material(body) and the ductile brittle temperature (DBT) of the material.
vodka [1.7K]

Explanation:

A ductile material can convert into brittle material due to following reasons

1.At very low temperature

2.Due to presence of notch

In titanic ,the base of ship strike to the large ice cube and lower part of titanic ship material was made of steel .We know that steel is ductile material and when steel came with very low temperature of ice due to this ductile material converted in to brittle material and titanic ship failed.Brittle material does not show any indication before failure.

7 0
3 years ago
How many broadcast or vlan is in this switchs and router ? and why? ​
Mnenie [13.5K]

Answer:The move from hubs (shared networks) to switched networks was a big improvement. Control over collisions, increased throughput, and the additional features offered by switches all provide ample incentive to upgrade infrastructure. But Layer 2 switched topologies are not without their difficulties. Extensive flat topologies can create congested broadcast domains and can involve compromises with security, redundancy, and load balancing. These issues can be mitigated through the use of virtual local area networks, or VLANs. This chapter provides the structure and operation of VLANs as standardized in IEEE 802.1Q. This discussion will include trunking methods used for interconnecting devices on VLANs.

Problem: Big Broadcast Domains

With any single shared media LAN segment, transmissions propagate through the entire segment. As traffic activity increases, more collisions occur and transmitting nodes must back off and wait before attempting the transmission again. While the collision is cleared, other nodes must also wait, further increasing congestion on the LAN segment.

The left side of Figure 4-1 depicts a small network in which PC 2 and PC 4 attempt transmissions at the same time. The frames propagate away from the computers, eventually colliding with each other somewhere in between the two nodes as shown on the right. The increased voltage and power then propagate away from the scene of the collision. Note that the collision does not continue past the switches on either end. These are the boundaries of the collision domain. This is one of the primary reasons for switches replacing hubs. Hubs (and access points) simply do not scale well as network traffic increases.

7 0
3 years ago
Air enters a 28-cm diameter pipe steadily at 200 kPaand 208C with a velocity of 5 m/s. Air is heated as it flows, and leaves the
Alina [70]

Answer:

(a) \dot V_1 = 0.308 m³/s

(b) \dot m = 0.732 kg/m³

(c) v₂ = 5.94 m/s.

Explanation:

(a) The volume flow rate is given by the cross sectional area of the pipe × Velocity of flow of air

Diameter of pipe = 28 cm = 0.28 m

The cross sectional area, A, of the pipe = 0.28²/4×π = 0.0616 m²

Volume flow rate = 5 × 0.0616  = 0.308 m³/s

\dot V_1 = 0.308 m³/s

(b) From the general gas equation, we have;

p₁v₁ = RT₁ which gives;

p₁/ρ₁ = RT₁

ρ₁ = p₁/(RT₁)

Where:

ρ₁ = Density of the air

p₁ = 200 kPa

T₁ = 20 C =

R = 0.287 kPa·m³/(kg·K)

ρ₁ = 200/(0.287 ×293.15) = 2.377 kg/m³

The mass flow rate = Volume flow rate × Density

The mass flow rate, \dot m = 2.377×0.308 = 0.732 kg/m³

\dot m = 0.732 kg/m³

(c) The density at exit, ρ₂, is found from the the universal gas equation as follows;

ρ₂ = p₂/(RT₂)

Where:

p₂ = Pressure at exit = 180 kPa

T₂ = Exit temperature = 40°C = 273.15 + 40 = 313.15 K

∴ ρ₂ = 180/(0.287×313.15) = 2.003 kg/m³

\dot m = ρ₂×\dot V_2

\dot V_2 = \dot m/ρ₂ = 0.732/2.003 = 0.366 m³/s

\dot V_2 = v₂ × A

v₂ = \dot V_2/A = 0.366/0.0616 = 5.94 m/s.

v₂ = 5.94 m/s.

5 0
3 years ago
Other questions:
  • SMAW and GMAW use constant current arc welding machines.<br><br> True<br><br> False
    8·1 answer
  • I have to find the critical points of this function of two variables <img src="https://tex.z-dn.net/?f=%5C%5Cf%28x%2Cy%29%3Dx%5E
    12·1 answer
  • The solid cylinders AB and BC are bonded together at B and are attached to fixed supports at A and C. The modulus of rigidity is
    6·1 answer
  • Bridge A is the longest suspension bridge in a Country. Bridge B is 5555 feet shortershorter than Bridge A. If the length of Bri
    9·1 answer
  • A circular ceramic plate that can be modeled as a blackbody is being heated by an electrical heater. The plate is 30 cm in diame
    15·1 answer
  • Examine a process whereby air at 300 K, 100 kPa is compressed in a piston/cylinder arrangement to 600 kPa. Assume the process is
    11·1 answer
  • Modify the Rainfall Statistics program you wrote for Programming Challenge 2 of Chapter 7 . The program should display a list of
    15·1 answer
  • When wasDisney Cruise Line founded
    5·1 answer
  • Which of the following is part of the highway
    11·2 answers
  • A standard penetration test has been conducted on a coarse sand at a depth of 16 ft below the ground surface. The blow counts ob
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!