[Tutor] Condition for variable which doesn’t exist yet
Dennis Lee Bieber
wlfraed at ix.netcom.com
Sat Oct 2 20:21:56 EDT 2021
On Sat, 2 Oct 2021 23:27:34 +0200, Julius Hamilton
<juliushamilton100 at gmail.com> declaimed the following:
>Another idea I have is just using a different loop type. Maybe a syntax
>like:
>
>do:
> l = input()
> if l == “” break
> g.append(l)
>
g = []
while True:
l = input()
if not l: break #empty strings, 0, empty lists are all "false"
g.append(l)
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
More information about the Tutor
mailing list