What is the error and how to fix it

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter7: String Manipulation
Section: Chapter Questions
Problem 6E
icon
Related questions
Question
What is the error and how to fix it
urce Run Debug Consoles Projects Tools View Help
日回 CMnea> ■
C\UserslosamalOneDrive\DesktoplOsama squlosamelpython\assginmnets
tve\Desktop\Osama squlosama\python\assginmnetW44.py
Name
Туре
Size
Value
aild_letter= ['A','AA', 'AB', 'AD', 'AR', 'AN', 'AN', "AY',
BA', 'BB','BD','BR', 'BM', 'BW', 'BY',
DA', 'DD', 'DR', 'DW', 'DY'
RA', 'RR','RM', 'RW', 'RY',
File1
TextIOWrapper 1
TextIOWrapper object of _io module
inputs
['12 A
, '123 BB
11st
line
Int
MA', 'MB', 'MM', 'MW', "MY',
"WA', "WB', 'WW',
"YA', 'YB','YD', "YR', 'YW', 'YY']
the vaild_letter list
['A', "AA", "AB", "AD, "AR', 'AM, "Aw', "AY', '8, 1
47
=1
i in input:
try:
x,y =
- i. split
if x[0]=="0":
try:
File3.write(x + " " + y + "In")
except IOError:
Variable explorer Help Plots Files
print("File Write Error : [Errno 13] Permission Denied : 'invalid. txt"")
O Console 7/A
elif int(x) > 99999:
try:
File3.write(x +""+ y + "In")
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
except IOError:
print("File Write Error : [Errno 13] Permission Denied : 'invalid. txt")
IPython 7.12.0 -- An enhanced Interactive Python.
elif y not in the_vaild_letter:
try:
File3.write(x + "" + y + "\n")
In [1]: runfile( 'C:/Users/osama/OneDrive/Desktop/Osama squ/osama/python/assginmnet4/H4
wdir='C:/Users/osama/OneDrive/Desktop/Osama squ/osama/python/assginmnet4')
Traceback (most recent call last):
except IOError:
print("File Write Error : [Errno 13] Permission Denied : 'inalid. txt'")
File "C:\Users losama\OneDrive\Desktop\Osama squ\osama\python\assginmnet4\H44.py", lin
in <module>
for i in input:
else:
try:
File2.write(x + "" + y + "\n")
TypeError: 'method' object is not iterable
except IOError:
print("File Write Error : (Errno 13] Permission Denied : 'valid, txt")
I
except ValueError:
print("Parse Error e Line number "+str(line)+" need more than 1 value to unpack:", i)
In (2):
line +s 1
IPython console History
* Kite: ready
O conda: base (Python 3.7.6)
Line 28, Col 15
UTFS
CRLF
RW
Transcribed Image Text:urce Run Debug Consoles Projects Tools View Help 日回 CMnea> ■ C\UserslosamalOneDrive\DesktoplOsama squlosamelpython\assginmnets tve\Desktop\Osama squlosama\python\assginmnetW44.py Name Туре Size Value aild_letter= ['A','AA', 'AB', 'AD', 'AR', 'AN', 'AN', "AY', BA', 'BB','BD','BR', 'BM', 'BW', 'BY', DA', 'DD', 'DR', 'DW', 'DY' RA', 'RR','RM', 'RW', 'RY', File1 TextIOWrapper 1 TextIOWrapper object of _io module inputs ['12 A , '123 BB 11st line Int MA', 'MB', 'MM', 'MW', "MY', "WA', "WB', 'WW', "YA', 'YB','YD', "YR', 'YW', 'YY'] the vaild_letter list ['A', "AA", "AB", "AD, "AR', 'AM, "Aw', "AY', '8, 1 47 =1 i in input: try: x,y = - i. split if x[0]=="0": try: File3.write(x + " " + y + "In") except IOError: Variable explorer Help Plots Files print("File Write Error : [Errno 13] Permission Denied : 'invalid. txt"") O Console 7/A elif int(x) > 99999: try: File3.write(x +""+ y + "In") Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. except IOError: print("File Write Error : [Errno 13] Permission Denied : 'invalid. txt") IPython 7.12.0 -- An enhanced Interactive Python. elif y not in the_vaild_letter: try: File3.write(x + "" + y + "\n") In [1]: runfile( 'C:/Users/osama/OneDrive/Desktop/Osama squ/osama/python/assginmnet4/H4 wdir='C:/Users/osama/OneDrive/Desktop/Osama squ/osama/python/assginmnet4') Traceback (most recent call last): except IOError: print("File Write Error : [Errno 13] Permission Denied : 'inalid. txt'") File "C:\Users losama\OneDrive\Desktop\Osama squ\osama\python\assginmnet4\H44.py", lin in <module> for i in input: else: try: File2.write(x + "" + y + "\n") TypeError: 'method' object is not iterable except IOError: print("File Write Error : (Errno 13] Permission Denied : 'valid, txt") I except ValueError: print("Parse Error e Line number "+str(line)+" need more than 1 value to unpack:", i) In (2): line +s 1 IPython console History * Kite: ready O conda: base (Python 3.7.6) Line 28, Col 15 UTFS CRLF RW
,"MB', 'MM", "A", 'MY',
(Python 3.7)
Search Source Run Debug Consoles Projects Tools View Help
四 @
CAUserslosamalOnebrvelDesktop1Osama squiosama\python\assginmnete
osamalOneDrive\Desktop\Osama squ\osama\python\assginmnetHW4.py
4 B , a o
4.py
Name
Туре
Size
Value
File1
TextIOWrapper 1
TextIOWrapper object of _1o nodule
Qauthor: osama
['12 A
, '123 B8
inputs
1ist
inputs""
try:
Filel- open("plates. txt", "r")
inputs-Filei.readlines()
except IOError:
line
Int
1
the veild letter list
['A', "AA', 'AB', 'AD', AR',
, "AM', 'AY', 8, BA, ...)
47
print("File Read Error : [Errno 2] No such file or directory : 'plates.txt")
File2- open ("valid. txt", "a")
6
File3e open("invalid. txt", "a")
18 - the_vaild letter- ['A', 'AA', 'AB', 'AD', "AR', "AM', "AW', 'AY',
19
20
'B', 'BA', "BB', 'BD', 'BR', 'BM", 'BW', "BY',
'D', 'DA', 'DD', 'DR', 'DW", "DY",
'R', 'RA', 'RR', 'RM', 'RW', 'RY
'S','SS
'M', 'MA', 'MB", 'MM', 'MW', 'MY',
"W', 'WA', "WB', 'MW',
'Y', 'YA', "YB', 'YD', 'YR', 'YW', 'YY']
21
Variable explorer Help Plots Files
22
23
O Console 7/A X
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
24
25
26
line-1
28 - for i in input
try:
27
IPython 7.12.0 -- An enhanced Interactive Python.
In [1): runfile('C:/Users/osama/OneDrive/Desktop/Osama squ/osama/python/assginmnet4/H44.py",
wdir-'C:/Users/osama/OneDrive/Desktop/Osama squ/osama/python/assginmnet4')
Traceback (most recent call last):
29
30
x,y - i. split
31
32
if x[0]=="0":
File "C:\Users\osama\OneDrive\Desktop\Osama squ\osama\python\assginmnet4\HW44.py", line 28,
in <module>
for i in input:
33
34
try:
File3.write(x +"+ y + *"\n")
-
except IOError:
print("File Write Error : [Errno 13] Perwission Denied : 'invalid. txt'")
35
36
TypeError: 'method' object is not iterable
37
38
elif int (x) > 99999:
try:
File3.write(x +"" + y + "In")
except IOError:
print("File Write Error : [Errno 13] Permission Denied : 'invalid, txt'")
39
40
In (2):
41
42
elif y not in the_vaild_letter:
try:
File3.write(x + " "
43
44
Python console History
+ y + "\n")
UTF-8
CRLF
RW
Mem 3
45
* Kite: ready
O conda: bese (Python 3.7.6)
Line 28, Col 15
7:14 PM
Transcribed Image Text:,"MB', 'MM", "A", 'MY', (Python 3.7) Search Source Run Debug Consoles Projects Tools View Help 四 @ CAUserslosamalOnebrvelDesktop1Osama squiosama\python\assginmnete osamalOneDrive\Desktop\Osama squ\osama\python\assginmnetHW4.py 4 B , a o 4.py Name Туре Size Value File1 TextIOWrapper 1 TextIOWrapper object of _1o nodule Qauthor: osama ['12 A , '123 B8 inputs 1ist inputs"" try: Filel- open("plates. txt", "r") inputs-Filei.readlines() except IOError: line Int 1 the veild letter list ['A', "AA', 'AB', 'AD', AR', , "AM', 'AY', 8, BA, ...) 47 print("File Read Error : [Errno 2] No such file or directory : 'plates.txt") File2- open ("valid. txt", "a") 6 File3e open("invalid. txt", "a") 18 - the_vaild letter- ['A', 'AA', 'AB', 'AD', "AR', "AM', "AW', 'AY', 19 20 'B', 'BA', "BB', 'BD', 'BR', 'BM", 'BW', "BY', 'D', 'DA', 'DD', 'DR', 'DW", "DY", 'R', 'RA', 'RR', 'RM', 'RW', 'RY 'S','SS 'M', 'MA', 'MB", 'MM', 'MW', 'MY', "W', 'WA', "WB', 'MW', 'Y', 'YA', "YB', 'YD', 'YR', 'YW', 'YY'] 21 Variable explorer Help Plots Files 22 23 O Console 7/A X Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. 24 25 26 line-1 28 - for i in input try: 27 IPython 7.12.0 -- An enhanced Interactive Python. In [1): runfile('C:/Users/osama/OneDrive/Desktop/Osama squ/osama/python/assginmnet4/H44.py", wdir-'C:/Users/osama/OneDrive/Desktop/Osama squ/osama/python/assginmnet4') Traceback (most recent call last): 29 30 x,y - i. split 31 32 if x[0]=="0": File "C:\Users\osama\OneDrive\Desktop\Osama squ\osama\python\assginmnet4\HW44.py", line 28, in <module> for i in input: 33 34 try: File3.write(x +"+ y + *"\n") - except IOError: print("File Write Error : [Errno 13] Perwission Denied : 'invalid. txt'") 35 36 TypeError: 'method' object is not iterable 37 38 elif int (x) > 99999: try: File3.write(x +"" + y + "In") except IOError: print("File Write Error : [Errno 13] Permission Denied : 'invalid, txt'") 39 40 In (2): 41 42 elif y not in the_vaild_letter: try: File3.write(x + " " 43 44 Python console History + y + "\n") UTF-8 CRLF RW Mem 3 45 * Kite: ready O conda: bese (Python 3.7.6) Line 28, Col 15 7:14 PM
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Encryption and decryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT