[Tutor] Fwd: Beginner struggling with python.

dn PythonList at DancesWithMice.info
Sun Jun 25 20:02:04 EDT 2023


On 23/06/2023 19.22, Jack Simpson wrote:
> ---------- Forwarded message ---------
> From: Jack Simpson <simpsonrmz41 at gmail.com>
> Date: Fri, 23 Jun 2023 at 1:58 pm
> Subject: Re: [Tutor] Beginner struggling with python.
> To: dn <PythonList at danceswithmice.info>
> 
> 
> I tried to use the string.upper() and it returned this syntax error. I also
> tried def upper() and upper(). I also tried underscores and spaces within
> the string in the parenthesis which produced a similar result but the issue
> was with the  code within the string. I am on a work computer using an
> interpreter so please forgive the photos from my phone.


Boy was I surprised to see a photo in a list-email!
- until I realised you had also sent a personal copy (directly) to me...

Suspect that you're only showing us part of the problem (also other 
messages). Please see @Alan's sage advice.

In this case, one must first define the string's value, and only 
thereafter apply the upper() method (function). First build the house, 
then apply the paint (change its appearance)!
(example in @Leam's response).

Apologies if the earlier explanation was unclear. In books and docs 
different fonts are used to differentiate between "string" as an 
identifier and "string" as a generic term/Python data-type. In email, 
not so easy! Accordingly, you could use any string-identifier, not only 
the word "string" - per @Leam's "f" identifier (which is a string 
data-type or object).

As he says, Python is fun to learn, and reasonably straight-forward. 
Keep ploughing-ahead. Like any other 'learning-curve', there's even more 
fun 'just around the bend...'!

-- 
Regards,
=dn


More information about the Tutor mailing list