Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looping and nested loops
#6
(Dec-20-2018, 12:02 PM)albry Wrote: so I understand, with the first {} in the line that is calling from the day in my total_days list? and the second {} is calling from my week in the total_weeks
No, it's not calling... It's string formatting. {} is a place-holder. Actual value comes from arguments of .format(). With f-strings in python 3.6+ it's even more convenient and natural.

Check

https://docs.python.org/3/library/stdtyp...str.format

and

https://docs.python.org/3/library/string...ing-syntax

(Dec-20-2018, 12:02 PM)albry Wrote: And every time a new value for 'rain' in input by the user, it will add a new element into the list 'daily_rain'?

yes, that is correct
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Looping and nested loops - by albry - Dec-20-2018, 10:52 AM
RE: Looping and nested loops - by buran - Dec-20-2018, 10:56 AM
RE: Looping and nested loops - by albry - Dec-20-2018, 11:16 AM
RE: Looping and nested loops - by buran - Dec-20-2018, 11:31 AM
RE: Looping and nested loops - by albry - Dec-20-2018, 12:02 PM
RE: Looping and nested loops - by buran - Dec-20-2018, 12:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  for loops break when I call the list I'm looping through Radical 4 823 Sep-18-2023, 07:52 AM
Last Post: buran
  reduce nested for-loops Phaze90 11 1,757 Mar-16-2023, 06:28 PM
Last Post: ndc85430
  Nested for loops: Iterating over columns of a DataFrame to plot on subplots dm222 0 1,638 Aug-19-2022, 11:07 AM
Last Post: dm222
  Nested for loops - help with iterating a variable outside of the main loop dm222 4 1,531 Aug-17-2022, 10:17 PM
Last Post: deanhystad
  breaking out of nested loops Skaperen 3 1,174 Jul-18-2022, 12:59 AM
Last Post: Skaperen
  Break out of nested loops muzikman 11 3,239 Sep-18-2021, 12:59 PM
Last Post: muzikman
  Looping through nested elements and updating the original list Alex_James 3 2,069 Aug-19-2021, 12:05 PM
Last Post: Alex_James
  How to break out of nested loops pace 11 5,262 Mar-03-2021, 06:25 PM
Last Post: pace
  Nested for Loops sammay 1 7,285 Jan-09-2021, 06:48 PM
Last Post: deanhystad
  How to make this function general to create binary numbers? (many nested for loops) dospina 4 4,331 Jun-24-2020, 04:05 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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