Python Forum
Regarding question on coding
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regarding question on coding
#2
Comprehensions can be unwound. Start at the end and work your way back to the assignment. Use the same process, but in reverse, to convert for loops to a comprehension.
for child in children:
    for month in months:
        dataset1.append(
            (month, np.dot(month, 24.7)+np.random.normal(loc=0, scale=20))
            )
Reply


Messages In This Thread
Regarding question on coding - by asmfloyd - May-26-2020, 01:04 AM
RE: Regarding question on coding - by deanhystad - May-26-2020, 05:06 AM
RE: Regarding question on coding - by buran - May-26-2020, 08:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Basic Coding Question: Exit Program Command? RockBlok 3 648 Nov-19-2023, 06:31 PM
Last Post: deanhystad
  Basic coding question with Python Than999 3 3,175 Jul-17-2019, 04:36 PM
Last Post: jefsummers
  Completely new to coding - quick question Oster22 1 2,737 Jun-19-2018, 08:42 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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