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
A hydraulic cylinder is to be used to move a workpiece in a manufacturing operation through a distance of 50 mm in 10 s. A force
svetlana [45]

Answer:

The answer to this question is 1273885.3 ∅

Explanation:

<em>The first step is to determine the required  hydraulic flow rate liquid if working pressure and  if a cylinder with a piston diameter of 100 mm is available.</em>

<em>Given that,</em>

<em>The distance = 50mm</em>

<em>The time t =10 seconds</em>

<em>The force F = 10kN</em>

<em>The piston diameter is = 100mm</em>

<em>The pressure = F/A</em>

<em> 10 * 10^3/Δ/Δ </em>

<em> P = 1273885.3503 pa</em>

<em>Then</em>

<em>Power = work/time  = Force * distance /time</em>

<em> = 10 * 1000 * 0.050/10</em>

<em>which is  =50 watt</em>

<em>Power =∅ΔP</em>

<em>50 = 1273885.3 ∅</em>

5 0
3 years ago
You want to plate a steel part having a surface area of 160 with a 0.002--thick layer of lead. The atomic mass of lead is 207.19
Pepsi [2]

Answer:

<u><em>To answer this question we assumed that the area units and the thickness units are given in inches.</em></u>

The number of atoms of lead required is 1.73x10²³.    

Explanation:

To find the number of atoms of lead we need to find first the volume of the plate:

V = A*t

<u>Where</u>:

A: is the surface area = 160

t: is the thickness = 0.002

<u><em>Assuming that the units given above are in inches we proceed to calculate the volume: </em></u>

V = A*t = 160 in^{2}*0.002 in = 0.32 in^{3}*(\frac{2.54 cm}{1 in})^{3} = 5.24 cm^{3}    

Now, using the density we can find the mass:

m = d*V = 11.36 g/cm^{3}*5.24 cm^{3} = 59.5 g

Finally, with the Avogadros number (N_{A}) and with the atomic mass (A) we can find the number of atoms (N):

N = \frac{m*N_{A}}{A} = \frac{59.5 g*6.022 \cdot 10^{23} atoms/mol}{207.19 g/mol} = 1.73 \cdot 10^{23} atoms    

Hence, the number of atoms of lead required is 1.73x10²³.

I hope it helps you!

3 0
3 years ago
Question 21(Multiple Choice
Katen [24]

Answer:

four seconds

Explanation:

lookin at a vehicle respectively at a second can cause accident

8 0
3 years ago
Read 2 more answers
A. A 3-kg plastic tank that has a volume of 0.2 m^3 is lled with liquid water. Assuming the density of water is 1000 kg=m^3, det
Tpy6a [65]

Answer:

The answer is below

Explanation:

a) The weight of the combined system is the sum of the weight of the water and the weight of the tank

m_{water}=V_{tank}.\rho_{wtaer}\\\\m_{water}=0.2m^3*1000kg/m^3\\\\m_{water}=200 \ kg\\\\m_{total} = m_{water}+m_{tank}\\\\But\ m_{tank}=3kg,therefore:\\\\m_{total} =200kg+3kg\\\\m_{total} =203\ kg\\\\weight_{total}=m_{total}g\\\\weight_{total}=203kg*9.81m/s^2\\\\weight_{total}=1991.43\ N

b) Since the weight of a system can be divided into smaller portions, hence weight is an extensive property.

c) When analyzing the acceleration of gases as they flow through a nozzle, the geometry of the nozzle which is an open system can be chosen as our system.

d) Given that:

\rho_{water}=1000kg/m^3\\\\1kg/m^3=0.062428lb/ft^3\\\\1000kg/m^3=1000kg/m^3*\frac{0.062428lb/ft^3}{kg/m^3}=62.43lb/ft^3\\ \\\rho=SG*\rho_{water}=1.03*62.43=64.272lb/ft^3\\\\P=P_{atm}+\rho g H\\\\P=14.7\ psia+64.272\ lb/ft^3*32.2\ ft/s^2*175\ ft*\frac{1\ ft^2}{12^2\ in^2}*\frac{1\ lbf}{32.2\ lbm.ft/s^2}  \\\\P=92.8\ psia

6 0
3 years ago
The melting point of Pb (lead) is 327°C, is the processing at 20°C hot working or cold working?
bonufazy [111]

Answer:

Explained

Explanation:

Cold working: It is plastic deformation of material at temperature below   recrystallization temperature. whereas hot working is deforming material above the recrystallization temperature.

Given melting point temp of lead is 327° C and lead recrystallizes at about

0.3 to 0.5 times melting temperature which will be higher that 20°C. Hence we can conclude that at 20°C lead will under go cold working only.

6 0
3 years ago
Other questions:
  • Can the United States defeat Iranian forces
    9·2 answers
  • Many people use microwave ovens to cook their food. Which option is best described as an engineering endeavor related to microwa
    9·2 answers
  • How was math used to determine new origami crease plans?
    10·1 answer
  • A horse on the merry-go-round moves according to the equations r = 8 ft, u = (0.6t) rad, and z = (1.5 sin u) ft, where t is in s
    5·1 answer
  • Someone please help me with this I’m stuck on it ?!i don’t have a lot of time
    12·1 answer
  • List two skills that are useful when working in teams.
    11·2 answers
  • You need to bake 2 dozen chocolate chip
    12·1 answer
  • It is the tool used to measure the amount of electric current​
    6·2 answers
  • Solved this question??????????????????
    13·1 answer
  • 2) What kinds of food can you eat in space?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!