Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Let him choose out of my files, his projects to accomplish. -- Shakespeare, "Coriolanus"


comp / comp.lang.python / Fw: Flubbed it in the second interation through the string: range error... HOW?

SubjectAuthor
o Fw: Flubbed it in the second interation through the string: range error... HOW?Kevin M. Wilson

1
Subject: Fw: Flubbed it in the second interation through the string: range error... HOW?
From: Kevin M. Wilson
Newsgroups: comp.lang.python
Date: Wed, 29 May 2024 04:38 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: kevinmwilson1956@yahoo.com (Kevin M. Wilson)
Newsgroups: comp.lang.python
Subject: Fw: Flubbed it in the second interation through the string: range
error... HOW?
Date: Wed, 29 May 2024 04:38:55 +0000 (UTC)
Lines: 73
Message-ID: <mailman.53.1716957543.2909.python-list@python.org>
References: <1901134155.5453771.1716957203090.ref@mail.yahoo.com>
<1901134155.5453771.1716957203090@mail.yahoo.com>
<1708304097.5451899.1716957535841@mail.yahoo.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de JAhaS/BJD38g3foTuop0hQzHcBq4Opg3q3kUlVwoM1sQ==
Cancel-Lock: sha1:Pjb3IKoUheZ9IjyJwbUv432spX4= sha256:kP5FUHZAMsUItkiw7gIhfjgl/Pi+pGsRZFv9Yr1npWE=
Return-Path: <kevinmwilson1956@yahoo.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=yahoo.com header.i=@yahoo.com header.b=LiClonfS;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.007
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'message:': 0.03; 'def':
0.04; 'traceback': 0.04; '(most': 0.05; 'received:66.163.188':
0.07; 'string': 0.07; 'elif': 0.09; 'readable': 0.09; 'string,':
0.09; '&gt;': 0.14; 'url:mailman': 0.15; '&lt;': 0.16; '---&gt;':
0.16; '2024': 0.16; 'lowercase': 0.16; 'string:': 0.16;
'subject:second': 0.16; 'subject:string': 0.16; 'to:addr:python-
list': 0.20; 'to:name:python-list@python.org': 0.24; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25; 'skip:{ 20':
0.26; 'error': 0.29; 'url-ip:188/8': 0.31; 'letter,': 0.32;
'python-list': 0.32; "i'm": 0.33; 'script': 0.33; 'someone': 0.34;
'header:In-Reply-To:1': 0.34; 'following': 0.35; 'received:66':
0.35; 'cell': 0.36; "it's": 0.37; '8bit%:14': 0.38;
'received:66.163': 0.39; 'received:consmr.mail.ne1.yahoo.com':
0.39; 'block': 0.39; 'should': 0.40; 'from:': 0.62; 'to:': 0.62;
'format': 0.62; 'lower': 0.62; 'email': 0.63; 'skip:m 20': 0.63;
'pass': 0.64; 'range': 0.64; '-----': 0.69; 'subject:through':
0.69; 'you.': 0.71; 'sent:': 0.78; '"when': 0.84; 'email name:&lt
;python-list': 0.84; 'subject: \n ': 0.84; 'you:': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1716957539; bh=UvyIs97l+a5/v2UNEWhKZwgnA+geolLmrlw+pmmRiws=;
h=Date:From:To:In-Reply-To:References:Subject:From:Subject:Reply-To;
b=LiClonfSz0wjK4NSefC1dBliud1ANB2lCbX2+JK9mDxH5cdLJUbAa3zga43Y13CHClPocmBEbfQAwskNeARkbOs14i3e2g0dXT+LYhd84wdwLlmQhHbN4Cy7RTs5SM/2UPf3Zt0cC/HFkEBQMQ/oygjb9OXymAHX2vLNnSlmr/xCvXWufBVHWaLld8Kxn2hLSzxjGbrp9Iybg7Cibu87w5Vt6UjAuCMhP44k0moMJz5GEE5GL+m0cG5ZF0XI8npafbkmNc7U9sKPjDxm/3KamFPQzzHkxQLEx9BnEU3aueuGgiwtsYmkSwsfh8O3weYn7wgRpMzVJ0dMHkgg9hpOOg==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1716957540; bh=bCtdOfHan9cxpvh2dt3Fno+nnhFIAeYltUmHrLSl+Eb=;
h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
b=nidsZbmCmlaHufJ2vj6ktyzoylAuRRVee5NFtjA72bhwZrQrjTMD+gcpK/LvTMi/TvS6btUi9J6k2rQvzqViEaJ2uKHSemo9GDDLYk6Q3UK3e3E29fDU9FAr8szArkkfFODMtniIPcG62T2q6nDQG61kaxw0oniq/QZBJKlocbU4RJAVMHMZ0mPagMFozbumoYR1e9QocusGcf0BC3b1VjYbNchWeAKrLj8I8BVLphBbZzNp8MS1pmov5AOsUXDOj0yG6xPSoX/DAExPHwWaBSEf5/NGPjWn7yQuTx7ySz80fewLDT4vrFV+FnN19oycJ+XAXxyycWlo6ZBTWQIR+w==
X-YMail-OSG: jsG9iQQVM1nUwyWHhIjb2o2bsfONNqzscAid3oxUdm9HFBN2U3ZDLSaAnA8f4MH
MSTpCUIwAQzSGwLTTURdxQFxFVkzPrt95Yn9KipLHCcpl3quEVowzvS5Xxfh8v6GMpuijtHHISa.
sG_Ir4HB3lkz.VvSfDJonApdVR7ckwHrNnaBMxZGlxsOGHuRVoKv3usGbJxJqmgSG7aFAtoRgera
af2h5itlFgqIej_SlAb4ZGT6q8NN7KRGjnaA5dR5ewv_g47RYf8QH8kdVjPXSBibA5dw4T8HJnvP
dqr0WyTSmM.NyTTtaUQLXcn9mcRv.35coklouhbtFhG7s2Ki.sm_8sPQQD3M9fqGoC3zLGA6ytGi
GoP0bvLl6v5twtKHCupaISW2PrfjJlsw895Ibt5A8vis9bf3_gDS_Yz37Iaa6jPCHooaTJ_6EASD
CcJxSx_caCJc2kpVKvgk96wZWQOX8JO2JhMDzphK2o8nPj0s8QTT1lBrESoD_YIck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lGgJ83r9HnQRrY1UKPwlKJU
4nsW6vwD85nYCXLz607gg3Fxd3eLWqEWRee2OtS9oGkeJ2xKIzztO.z1sSv.UeUsatCoEnjWgADn
cyVVdFh8St3GCcI1RSSFLxHZCVH.HQBAok90aKRZqns_peNPHprStIkI6uEEYQivR.h16s4jG7.J
hVVvE.Ifzg2QXy.u5BF2jKjJIsEfumhthPKZlCoA3DLIssnUI02FD7te1mem.deo2gCtYFI2tRPV
bvHjzqs66_lADjzgv2iPXMkn_cv3nF_DHuUw7iQOfXlUAGzM_AG9xoeI6M1tVaDoMBsejk9WRntu
fcUlMbsUcDNStP96dqgG8Wioub8YX8uUD7OGdQX.wSD9Ih.11bd1vlvPzWzQZ2rIjqV2USnCbRxe
Z6RZrS0BO0ha_TFsRd1NBFHoNPWIoIV9LCVAJZytX8zhfhe8GCAr42O22MmKaN0VR.0KQOAyaMlP
iV75hsW09tazzqwBZC6zgvVvn61jQIqr5svBlhu3E6E6CCAwyQx_txZSJm2yGrFMQmzocI3OkPbd
5q9xX5s4ITqwH1X7CIj9S4de2xfJUFU4FeC0_uLpi3FFr_P_HEJUdDm62WAwkmpUVCzvLVP4xzaB
lwdZiTwGbl_89BzP_QxS40SY1dAmLxihxcstwWkTe.w3HUb1elREXM3ZEv6pYcSZ9DrlKcTnoVF4
mB0JYeOhoYq8d3LWUVYG.6RbMvCp6t8sw40UWDevzG0.AYEIoAakJOJkVr.HWJW3v
X-Sonic-MF: <kevinmwilson1956@yahoo.com>
X-Sonic-ID: 62c3dd49-05f1-4eb2-987a-1e66d3c52d6e
In-Reply-To: <1901134155.5453771.1716957203090@mail.yahoo.com>
X-Mailer: WebService/1.1.22356 YMailNorrin
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <1708304097.5451899.1716957535841@mail.yahoo.com>
X-Mailman-Original-References: <1901134155.5453771.1716957203090.ref@mail.yahoo.com>
<1901134155.5453771.1716957203090@mail.yahoo.com>
View all headers

The format in this email is not of my making, should someone know, how to do this so that it's a readable script do tell!
KMW

***************************************************
"When you pass through the waters, I will be with you: and when you pass through the rivers, they will not sweep over you. When you walk through the fire, you will not be burned: the flames will not set you ablaze."     
Isaiah 43:2

----- Forwarded Message ----- From: Kevin M. Wilson via Python-list <python-list@python.org>To: python-list@python.org <python-list@python.org>Sent: Tuesday, May 28, 2024 at 10:35:23 PM MDTSubject: Flubbed it in the second interation through the string: range error... HOW?
The following is my effort to understand how to process a string, letter, by letter:
def myfunc(name):        index = 0    howmax = len(name)    # while (index <= howmax):    while (index < howmax):        if (index % 2 == 0):            print('letter to upper = {}, index {}!'.format(name[index], index))            name = name[index].upper()            print('if block {} and index {}'.format(name[index], index))        elif (index % 2 > 0):            print(index)            print('Start: elseif block, index is {}, letter is {}'.format(index, name))            # print('letter to lower = {}'.format(name[index]))            # print('Already lowercase do noting: name = {}'.format(name[index]))        index += 1        # index = name.upper()        
    return name        
myfunc('capitalism')
Error message:                        Not making sense, index is 1, letter s/b 'a'letter to upper = c, index 0!
if block C and index 0
1 Start: elseif block, index is 1, letter is C
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[27], line 21
    17        # index = name.upper()       
    19    return name       
---> 21 myfunc('capitalism')

Cell In[27], line 8, in myfunc(name)
      6 while (index < howmax):
      7    if (index % 2 == 0):
----> 8        print('letter to upper = {}, index {}!'.format(name[index], index))
      9        name = name[index].upper()
    10        print('if block {} and index {}'.format(name[index], index))

IndexError: string index out of range***************************************************
So, I'm doing something... Stupid!!
***************************************************
"When you pass through the waters, I will be with you: and when you pass through the rivers, they will not sweep over you. When you walk through the fire, you will not be burned: the flames will not set you ablaze."     
Isaiah 43:2
--
https://mail.python.org/mailman/listinfo/python-list

1

rocksolid light 0.9.8
clearnet tor