Question

Problem 2. (Five in a Row) Write a program five_per_row.py that writes the integers 101 to...

Problem 2. (Five in a Row) Write a program five_per_row.py that writes the integers 101 to 200 with five numbers per line. Hint: use the % operator.
$ python3 five_per_row.py 101 102 103 104 105 106 107 108 109 110 ... 196 197 198 199 200​

0 0
Add a comment Improve this question Transcribed image text
Answer #1

\color{blue}\underline{five\_per\_row.py:}

file = open("outputFile.txt", "w")
for i in range(101,201):
    file.write(str(i))
    if(i%5 != 0):
        file.write(" ")
    else:
        file.write("\n")

\color{blue}\underline{outputFile.txt:}

101 102 103 104 105
106 107 108 109 110
111 112 113 114 115
116 117 118 119 120
121 122 123 124 125
126 127 128 129 130
131 132 133 134 135
136 137 138 139 140
141 142 143 144 145
146 147 148 149 150
151 152 153 154 155
156 157 158 159 160
161 162 163 164 165
166 167 168 169 170
171 172 173 174 175
176 177 178 179 180
181 182 183 184 185
186 187 188 189 190
191 192 193 194 195
196 197 198 199 200

\color{red}Please\; upvote\;the \;solution \;if \;it \;helped.\;Thanks!

Add a comment
Know the answer?
Add Answer to:
Problem 2. (Five in a Row) Write a program five_per_row.py that writes the integers 101 to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • develop a spanning tree for the configuration of the figure Bridge 103 Bridge 104 ridge Bridge...

    develop a spanning tree for the configuration of the figure Bridge 103 Bridge 104 ridge Bridge 101 102 Bridge 106 Bridge 105 BridgeBridge 108 Bridge 109 Bridge 110 107

  • Apply the Apriori algorithm to the following data set: Trans Id Item Purchased 101 milk, bread,...

    Apply the Apriori algorithm to the following data set: Trans Id Item Purchased 101 milk, bread, eggs 102 milk, juice 103 juice, butter 104 milk, bread, eggs 105 coffee, eggs 106 coffee 107 coffee, juice 108 milk, bread, cookies, eggs 109 cookies, butter 110 milk, bread The set of items is {milk, bread, cookies, eggs, butter, coffee, juice}. Use 2 for the minimum support value.

  • 11.37 The quality control director for a clothing manufac- turer wants to study the effect of ope...

    11.37 The quality control director for a clothing manufac- turer wants to study the effect of operators and machines on the breaking strength (in pounds) of wool serge material A batch of the material is cut into square-yard pieces, and these pieces are randomly assigned, 3 each. to each of the 12 combinations of 4 operators and 3 machines chosen spe- cifically for the experiment. The results. stored in Breakstw are as follows: Machine Operator 109 110 107 110 1...

  • 2. Assume that the first set of scores below represents the IQ scores of children who...

    2. Assume that the first set of scores below represents the IQ scores of children who have been participating in a school lunch program and the second set of scores represent the IQs of a similar group of children who have not participated in the program. a.         Prepare appropriate graphical representations of the frequency and relative frequency distributions. b.         Compare the two distributions by placing them on the same graph. Be sure to have equivalent intervals, if grouped....

  • weight of 30 people: 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,...

    weight of 30 people: 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110 screenshot of matlab is needed, please and thank you Create your own data that represents the weight of 30 people.Test the null hypothesis that the data comes from a normal distribution with mean mu = 70 and standard deviation sigma = 8. Hint: use the “ztest"...

  • $ $1,390.000 % 100.0% $574,700 $105,000 100 101 102 Net sales $1,390,000 103 Gross margin $574,700...

    $ $1,390.000 % 100.0% $574,700 $105,000 100 101 102 Net sales $1,390,000 103 Gross margin $574,700 104 Profit $105,000 105 106 Net Sales Problem One 107 -COGS 108 =GM 109 -Expenses 110 =Profit/Loss 111 11.Skeletal Profit and Loss Statement: Set up skeletal profit and loss statement in both dollars and percentage 112 given the information. 113 Gross margin $535,000 114 Gross margin 25% 115 Expenses $625,000 116 117 Net Sales Problem Two 118 -COGS 119 =GM 120 -Expenses 121 =Profit/Loss...

  • 1.         For each set below, using Excel, construct            a.         a frequency distribution,   ...

    1.         For each set below, using Excel, construct            a.         a frequency distribution,    b.         a relative frequency distribution, and            c.         a cumulative relative frequency distribution. Consider whether or not you should group your data. Describe how you determined your bin width, if you grouped the data in intervals. Set 1 75    95    103 100 93 91 90 92 89 105 86 85 81 96 103 99 94 95 91 97 92 107...

  • Use minitab if possible. If it is, please show step by step process of how you...

    Use minitab if possible. If it is, please show step by step process of how you did it. Surface roughness of steel is investigated. The method of surface manufacturing largely determines roughness of the surface. One of the parameters to describe the roughness is Rz, the maximum height of the surface irregularities profile. R (in um) is measured for 21 random places on the surface of forged details and 21 random places on the surface of casted details as follows....

  • 1. Find the 5-Number Summary and graph boxplots from a data set. The data are distances in feet of Mark McGwire and Samm...

    1. Find the 5-Number Summary and graph boxplots from a data set. The data are distances in feet of Mark McGwire and Sammy Sosa’s, home runs, respectively for the 1998 baseball season (they both broke Roger Maris’s home run record in 1998). - Which player has the longest distances? - Which player appears to have the most consistent distances? How can you tell from the boxplot? data: McGwire, Sosa 306, 371 420, 430 440, 440 350, 400 478, 370 425,...

  • Problem 1 The following data are from a research project on the effectiveness of a drug in reducing LDL chole...

    Problem 1 The following data are from a research project on the effectiveness of a drug in reducing LDL cholesterol levels. While some patients in the study are assigned to the drug, others were given a placebo. Because the information about who is receiving the actual drug is kept confidential from those taking LDL measurements, that information is kept in a separate data set. Given below in Data Set A are the initial LDL cholesterol level of each individual before...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT