[Tutor] what is wrong with the syntax?

2010-07-10 Thread Dipo Elegbede
Hi all,

please tell me what is wrong with the syntax as written herein:

http://pastebin.com/BkLi0A4H

I am actually trying to let a user input something and have the input
returned in a reverse form and also see the lenght of the input.

please help.

-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application
Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with the syntax?

2010-07-10 Thread Steve Willoughby

On 10-Jul-10 10:05, Dipo Elegbede wrote:

Hi all,
please tell me what is wrong with the syntax as written herein:
http://pastebin.com/BkLi0A4H
I am actually trying to let a user input something and have the input
returned in a reverse form and also see the lenght of the input.
please help.


Is this for Python 3.x or 2.x?  It makes a big difference in what 
input() means.  I'm guessing 2.x from the rest of the script, so what 
you probably want is raw_input, not input unless you really want 
them to type Python source there which is interpreted as a list of 
values or whatever.


I'm not sure what you want to accomplish with str() and list(), though. 
 Those create a string, and then a list, but you never assign the new 
string or list to anything.  Neither actually changes the wording 
variable.


Remember that the comma separating items in the print statement is a 
syntactic feature of the language.  You have them inside the strings 
you're printing.




--
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com http://www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise
Application Development



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with the syntax?

2010-07-10 Thread Alan Gauld


Dipo Elegbede delegb...@dudupay.com wrote


please tell me what is wrong with the syntax as written herein:

http://pastebin.com/BkLi0A4H


Please post full error reports as well as the code. It helps a lot!

You code has numerous errrs in it but the syntax errors are in
the print statements. You need to separate the arguments to
print with commas.

Also for the function to do anything you need to call it.

I am actually trying to let a user input something and have the 
input

returned in a reverse form and also see the lenght of the input.


I also think your call to list and reversed is the wrong way round.
It should be:

reversed(list(wording))

I see Steve has already picked up most of the other mistakes.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] what is wrong with this syntax?

2010-05-18 Thread Dipo Elegbede
ples help me figure out what is wrong with this syntax?


print('Here are the numbers from 0 to 9')
for i in the range(10):
print(i)

thank you.

i am currently reading a byte of a python.

thanks.

-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application
Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread zaldi
in the header of for loop, you don't need to use the - for i in range(10)

On 5/18/10, Dipo Elegbede delegb...@dudupay.com wrote:
 ples help me figure out what is wrong with this syntax?


 print('Here are the numbers from 0 to 9')
 for i in the range(10):
 print(i)

 thank you.

 i am currently reading a byte of a python.

 thanks.

 --
 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise Application
 Development

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread alex gunn
its the the part

print('Here are the numbers from 0 to 9')
# for i in the range(10):  #your version
for i in range(10): #try this
print(i)

im still learning myself, so be gentle if im wrong but it worked for me.

Alex
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread Vern Ceder

Dipo Elegbede wrote:

ples help me figure out what is wrong with this syntax?


print('Here are the numbers from 0 to 9')
for i in the range(10):
print(i)


Remove the word the

print('Here are the numbers from 0 to 9')
for i in range(10):
 print(i)


Cheers,
Vern



thank you.

i am currently reading a byte of a python.

thanks.

--
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com http://www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise 
Application Development





___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


--
This time for sure!
   -Bullwinkle J. Moose
-
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
vce...@canterburyschool.org; 260-436-0746; FAX: 260-436-5137

The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread Dipo Elegbede
all worked well.
thanks all.

On Tue, May 18, 2010 at 2:47 PM, alex gunn alex.g...@smallshinyant.comwrote:

 its the the part

 print('Here are the numbers from 0 to 9')
 # for i in the range(10):  #your version
 for i in range(10): #try this
 print(i)

 im still learning myself, so be gentle if im wrong but it worked for me.

 Alex




-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application
Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread Steven D'Aprano
On Tue, 18 May 2010 11:36:02 pm Dipo Elegbede wrote:
 ples help me figure out what is wrong with this syntax?


 print('Here are the numbers from 0 to 9')
 for i in the range(10):
 print(i)

 thank you.

Others have already given you the answer, but more important is for you 
to learn *how* to get the answer.

Look at the error message Python prints:

 for i in the range(10):
  File stdin, line 1
for i in the range(10):
 ^
SyntaxError: invalid syntax


You get a SyntaxError, which tells you that what you've written makes no 
sense to the Python compiler. It also tells you that the error has 
nothing to do with either of the print lines.

Unfortunately Python isn't smart enough to recognise that the problem is 
with the rather than range(10), but it points you to the correct 
line.



-- 
Steven D'Aprano
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread Dipo Elegbede
thanks Steven. I'll always be mindful of that.
By the way, I need someone to briefly explain to me how the while loop works.
a little on break will also do.
thanks.

On 5/18/10, Steven D'Aprano st...@pearwood.info wrote:
 On Tue, 18 May 2010 11:36:02 pm Dipo Elegbede wrote:
 ples help me figure out what is wrong with this syntax?


 print('Here are the numbers from 0 to 9')
 for i in the range(10):
 print(i)

 thank you.

 Others have already given you the answer, but more important is for you
 to learn *how* to get the answer.

 Look at the error message Python prints:

 for i in the range(10):
   File stdin, line 1
 for i in the range(10):
  ^
 SyntaxError: invalid syntax


 You get a SyntaxError, which tells you that what you've written makes no
 sense to the Python compiler. It also tells you that the error has
 nothing to do with either of the print lines.

 Unfortunately Python isn't smart enough to recognise that the problem is
 with the rather than range(10), but it points you to the correct
 line.



 --
 Steven D'Aprano
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise
Application Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread Dipo Elegbede
A LITTLE EXPLANATIONS ON CONTINUE WOULD BE APPRECIATED TOO.
in a recap, i would appreciate any brief explanation on
1. break
2. continue
3. while loop

how they work and application in writing codes.

thank you all.

On 5/18/10, Dipo Elegbede delegb...@dudupay.com wrote:
 thanks Steven. I'll always be mindful of that.
 By the way, I need someone to briefly explain to me how the while loop
 works.
 a little on break will also do.
 thanks.

 On 5/18/10, Steven D'Aprano st...@pearwood.info wrote:
 On Tue, 18 May 2010 11:36:02 pm Dipo Elegbede wrote:
 ples help me figure out what is wrong with this syntax?


 print('Here are the numbers from 0 to 9')
 for i in the range(10):
 print(i)

 thank you.

 Others have already given you the answer, but more important is for you
 to learn *how* to get the answer.

 Look at the error message Python prints:

 for i in the range(10):
   File stdin, line 1
 for i in the range(10):
  ^
 SyntaxError: invalid syntax


 You get a SyntaxError, which tells you that what you've written makes no
 sense to the Python compiler. It also tells you that the error has
 nothing to do with either of the print lines.

 Unfortunately Python isn't smart enough to recognise that the problem is
 with the rather than range(10), but it points you to the correct
 line.



 --
 Steven D'Aprano
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor



 --
 Elegbede Muhammed Oladipupo
 OCA
 +2348077682428
 +2347042171716
 www.dudupay.com
 Mobile Banking Solutions | Transaction Processing | Enterprise
 Application Development



-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise
Application Development
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread bob gailer

On 5/18/2010 11:23 AM, Steven D'Aprano wrote:

Others have already given you the answer, but more important is for you
to learn *how* to get the answer.

Look at the error message Python prints:

   

for i in the range(10):
 

   File stdin, line 1
 for i in the range(10):
  ^
SyntaxError: invalid syntax


You get a SyntaxError, which tells you that what you've written makes no
sense to the Python compiler. It also tells you that the error has
nothing to do with either of the print lines.

Unfortunately Python isn't smart enough to recognise that the problem is with the 
rather than range(10)
   


To be more specific - Python is happy with for i in the . It is 
expectingeither : or some operator. range is neither - so that is 
where the error pointer is.


Example:

the = [1,2,3]
for i in the:
  print(i)
for i in the + [4]:
  print(i)

--
Bob Gailer
919-636-4239
Chapel Hill NC

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread Alan Gauld


Dipo Elegbede delegb...@dudupay.com wrote

By the way, I need someone to briefly explain to me how the while 
loop works.

a little on break will also do.


Your tutorial should do that but you can also look at the Loops
section of my tutorial - use the V3 version - for a discussion of 
while loops.


It does not cover break/continue because they are not really necessary
to write programs, simply convenience features so I don't cover them
till much later.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread spir ☣
On Wed, 19 May 2010 01:23:55 +1000
Steven D'Aprano st...@pearwood.info wrote:

 On Tue, 18 May 2010 11:36:02 pm Dipo Elegbede wrote:
  ples help me figure out what is wrong with this syntax?
 
 
  print('Here are the numbers from 0 to 9')
  for i in the range(10):
  print(i)
 
  thank you.
 
 Others have already given you the answer, but more important is for you 
 to learn *how* to get the answer.
 
 Look at the error message Python prints:
 
  for i in the range(10):
   File stdin, line 1
 for i in the range(10):
  ^
 SyntaxError: invalid syntax
 
 
 You get a SyntaxError, which tells you that what you've written makes no 
 sense to the Python compiler. It also tells you that the error has 
 nothing to do with either of the print lines.
 
 Unfortunately Python isn't smart enough to recognise that the problem is 
 with the rather than range(10), but it points you to the correct 
 line.

And logically, if the error is not at the pointed word/line, it will be just 
before.

This means that when analysing your code, python passed on the real error 
cause, because of a possible ambiguity; but then the rest makes no sense, so it 
stops and points where it got blocked, immediately after the error.
In the code above, the could be a name you gave to a list, for instance; 
since an expression starting like for i in listName is correct, Python cannot 
stop on the... but then the rest of the line makes no more sense for it.

(Fortunately, python 3.2, planned for April 1, 2011, will be informed that 
the is an english article. This is possible since there is no ambiguity with 
thé (fr), thank to Python's clever diacritic-awareness. Only remains then the 
problematic case of a.)


Denis


vit esse estrany ☣

spir.wikidot.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what is wrong with this syntax?

2010-05-18 Thread Steven D'Aprano
On Wed, 19 May 2010 03:29:46 am spir ☣ wrote:
 (Fortunately, python 3.2, planned for April 1, 2011, will be informed
 that the is an english article. This is possible since there is no
 ambiguity with thé (fr), thank to Python's clever
 diacritic-awareness. Only remains then the problematic case of a.)

I know you are joking, but that's exactly what Apple's Hypertalk 
programming language did. In Hypertalk, you could write:

  get the second field
  put it before the third field 
  go to the last card of the next background

or:

  get second field
  put it before third field 
  go to last card of next background



-- 
Steven D'Aprano
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor