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
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