Python Forum
[split] Please help with SyntaxError: invalid syntax
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Please help with SyntaxError: invalid syntax
#1
Hi,

There is this short code which I have written. The variable Vinf_values is saved in a list. I am trying to evaluate P0 and T0 and here I am using the list of Mf_values as you can see. I want to save the four values of P0 and T0 in a list like for Mf_values. However, Python returns with an error.

 Mf_values = [0.8, 0.9, 1.2, 1.5]
Vinf_values = [Mf_value * (gamma * R * tatm) ** 0.5 for Mf_value in Mf_values]
P0=[(1+((gamma-1)/2)*(Mf_values**2)**(gamma/(gamma-1))*patm]
T0=[(1+((gamma-1)/2)*(Mf_values**2))*tatm]
pg=P0-patm
    T0=(1+((gamma-1)/2)*(Mf_values**2))*tatm
     ^
SyntaxError: invalid syntax 
Reply
#2
Line 1 is indented when there is no need for it to be indented.
line 3 has 1 more open bracket than close bracket.
line 6 is indented when there is no need for it to be indented.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Invalid syntax Slome 2 1,943 May-13-2022, 08:31 PM
Last Post: Slome
  print(f"{person}:") SyntaxError: invalid syntax when running it AryaIC 11 16,266 Nov-07-2020, 10:17 AM
Last Post: snippsat
  Invalid syntax error, where? tucktuck9 2 3,401 May-03-2020, 09:40 AM
Last Post: pyzyx3qwerty
  Invalid syntax defining a dictionary? ep595 6 5,066 Nov-19-2019, 08:06 PM
Last Post: ThomasL
  Syntax Error: Invalid Syntax in a while loop sydney 1 4,058 Oct-19-2019, 01:40 AM
Last Post: jefsummers
  SyntaxError: Invalid syntax in a while loop ludegrae 3 14,683 Dec-18-2018, 04:12 PM
Last Post: Larz60+
  SyntaxError: invalid syntax at run .py tuxo9999 10 7,226 Aug-23-2018, 03:58 PM
Last Post: Axel_Erfurt
  Homework: Invalid syntax using if statements chehortop 3 3,635 Mar-01-2018, 04:38 AM
Last Post: micseydel
  invalid syntax error penlemon 4 3,814 Jan-27-2018, 02:46 PM
Last Post: sparkz_alot
  Invalid syntax: string index out of range darkreaper1959 6 6,139 Jan-22-2017, 06:24 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020