Trying to understand nested loops

Lars Liedtke lal at solute.de
Fri Aug 5 03:47:22 EDT 2022


Hello,

this looks to me like it might be a piece of homework, as it would be 
given by teachers or professors.

This list has got the rule, that members do not solve other's homework. 
Because very often homework is meant to sit down and think about it.

But maybe I interpreted that wrongly, so if you could try to formulate 
in words what this loop does, I or other people on this list, will be 
pleased to show you where you might have got things wrong and how it 
really works.

Cheers

Lars


-- 
Lars Liedtke
Software Entwickler

			
Phone: 	
Fax: 	+49 721 98993-
E-mail:	lal at solute.de


solute GmbH
Zeppelinstraße 15				
76185 Karlsruhe
Germany


Marken der solute GmbH | brands of solute GmbH
billiger.de | Shopping.de 


Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd Vermaaten
Webseite | www.solute.de
Sitz | Registered Office: Karlsruhe
Registergericht | Register Court: Amtsgericht Mannheim
Registernummer | Register No.: HRB 110579
USt-ID | VAT ID: DE234663798


Informationen zum Datenschutz | Information about privacy policy
http://solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php

Am 05.08.22 um 09:34 schrieb ojomooluwatolami675 at gmail.com:
> Hello, I’m new to learning python and I stumbled upon a question nested loops. This is the question below. Can you please how they arrived at 9 as the answer. Thanks
>
> var = 0
> for i in range(3):
>    for j in range(-2,-7,-2):
>      var += 1
>       print(var)
>
> Sent from my iPhone



More information about the Python-list mailing list