Python Forum
Need to fix SyntaxError in cycle try
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to fix SyntaxError in cycle try
#4
Line 2 is 219 characters long. It is way too long. A good rule of thumb is that a line should not exceed 70 or 80 characters. In Python, one can achieve this by enclosing long expressions in parentheses, for example
idef function_gam(et, y3, phb, kj, y7):
  ht = (
      kj[0] * et * cos(y3) / sqrt(phb)
      + kj[1] * -et0 * sin(y3) / sqrt(phb)
      + y7 * sqrt(1 / phb) * et0 * sin(y3)
      + funct_labt(y3, kj[1], y7, kj[0])
        * (sqrt(1 / phb) * (
            1 + et * cos(y3) * (1 + et * cos(y3)**2) / phb**2)))
  return ht
 
This line could perhaps be further divided in several lines.
alexfrol86 likes this post
Reply


Messages In This Thread
RE: Need to fix SyntaxError in cycle try - by Gribouillis - Mar-24-2022, 10:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Writing a cycle to find the nearest point from the array Tysrusko 0 194 May-10-2024, 11:49 AM
Last Post: Tysrusko
  Trying to cycle through a list of charcters pooky2483 12 4,644 Sep-28-2020, 06:55 AM
Last Post: pooky2483
  <while> cycle is not interrupted when using the <random>module ShityCoder 3 2,253 Sep-04-2020, 04:05 PM
Last Post: ShityCoder
  Cycle of numpy variables Zero01 0 1,586 Jul-31-2020, 11:58 AM
Last Post: Zero01
  stop cycle while windows11 1 2,080 May-16-2020, 03:17 PM
Last Post: deanhystad
  Occurrences using FOR and IF cycle P86 2 2,576 Jul-29-2019, 04:37 PM
Last Post: ThomasL
  pool map cycle skorost5 5 3,906 Apr-07-2019, 09:21 AM
Last Post: skorost5
  lifetime cycle counter Ixxxxxx 0 2,524 Mar-07-2018, 07:26 PM
Last Post: Ixxxxxx

Forum Jump:

User Panel Messages

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