Question: Please solve using Python Programming In Exercises 1 through 8, determine the sequence generated by the range function. 1. range(7, 11) 3. range(2, 14, 3)
Please solve using Python Programming
In Exercises 1 through 8, determine the sequence generated by the range function.
1. range(7, 11)
3. range(2, 14, 3)
5. range(6)
7. range(11, 7, -1)
In Exercises 9 through 16, determine a range function that generates the sequence of numbers.
9. 4, 9, 14, 19
11. 21, 20, 19, 18
13. 20, 17, 14
15. 5, 4, 3, 2, 1, 0
In Exercises 37 and 38, assume that the six lines of the file Numbers.txt contain the data 6, 9, 2, 3, 6, and 4.
37.
sumEvens = 0
infile = open("Numbers.txt", 'r') for line in infile: if eval(line) % 2 == 0: sumEvens += eval(line) infile.close() print(sumEvens)
In Exercises 39 and 40, assume that the 50 lines of the file States.txt contain the names of the fifty states in the order they joined the union.
39.
infile = open("States.txt", 'r') for line in infile: if line.startswith("North"): print(line, end="") infile.close()
In Exercises 41 through 46, identify all errors.
41.
for j in range(1, 26, -1): print(j)
43.
list1 = [2, 5, 7, 2, 7, 8]
list2 = [] for item in list1: if item not in list2: list2.append(item) print list2
45.
# Display all numbers from 0 through 19 except for 13 for i in range(20, 0): if i != 13: print(i)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
