Click here to Skip to main content
15,391,989 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
These are my code and i noticed an error like this
:
 File "<ipython-input-161-70977abcbe00>", line 6
    B_ ivtt1 = Beta('B_ ivtt1', 0, None, None, 0)
       ^
SyntaxError: invalid syntax

my code:
ASC_autod = Beta('ASC_autod', 0, None, None, 0)
ASC_autop = Beta('ASC_autop', 0, None, None, 0)
ASC_walk = Beta('ASC_walk', 0, None, None, 0)
ASC_metro = Beta('ASC_metro', 0, None, None, 0)
ASC_ctrain = Beta('ASC_ctrain', 0, None, None, 1)
B_ ivtt1 = Beta('B_ ivtt1', 0, None, None, 0)
B_ ivtt2 = Beta('B_ ivtt2', 0, None, None, 0)
B_ ivtt3 = Beta('B_ ivtt3', 0, None, None, 0)
B_ ivtt4 = Beta('B_ ivtt4', 0, None, None, 0)
B_ ivtt5 = Beta('B_ ivtt5', 0, None, None, 0)
B_ avail1 = Beta('B_ avail1 ', 0, None, None, 0)
B_ avail2 = Beta('B_ avail2 ', 0, None, None, 0)
B_ avail3 = Beta('B_ avail3 ', 0, None, None, 0)
B_ avail4 = Beta('B_ avail4 ', 0, None, None, 0)
B_ avail5 = Beta('B_ avail5 ', 0, None, None, 0)
B_ t-fare = Beta('B_ t-fare ', 0, None, None, 0)
B_ g-fare = Beta('B_ g-fare ', 0, None, None, 0)
B_age = Beta('B_age', 0, None, None, 0)
B_pinc = Beta('B_pinc', 0, None, None, 0)
B_occ = Beta('B_occ', 0, None, None, 0)
B_hhsize = Beta('B_hhsize', 0, None, None, 0)
B_nveh = Beta('B_nveh', 0, None, None, 0)
B_nwkrs = Beta('B_nwkrs', 0, None, None, 0)
B_hinc = Beta('B_hinc', 0, None, None, 0)

What I have tried:

Hi
I noticed
invalid syntax
in my code . I tried to fix it in a different way but no success, could you please help me

Thanks
Posted
Updated 18-Feb-21 20:05pm
Comments
Peter_in_2780 18-Feb-21 22:06pm
   
My guess is that all the spaces after B_ shouldn't be there. Try removing them.

1 solution

Look at the line it complains about - it tells you exactly which line it is (line 6) and even takes the time to highlight where the problem is:
B_ ivtt1 = Beta('B_ ivtt1', 0, None, None, 0)
   ^
What is the space doing there between "B_" and "ivtt1"?
Variable names cannot contain spaces.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900