Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98859 > unrolled thread
| Started by | jbak36 <j.bak36@gmail.com> |
|---|---|
| First post | 2015-11-15 12:38 -0800 |
| Last post | 2015-11-19 19:26 -0800 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
Why won't this run? jbak36 <j.bak36@gmail.com> - 2015-11-15 12:38 -0800
Re: Why won't this run? Tim Chase <python.list@tim.thechases.com> - 2015-11-15 14:55 -0600
Re: Why won't this run? Gary Herron <gherron@digipen.edu> - 2015-11-15 12:50 -0800
Re: Why won't this run? Mike S <mscir@yahoo.com> - 2015-11-19 19:26 -0800
| From | jbak36 <j.bak36@gmail.com> |
|---|---|
| Date | 2015-11-15 12:38 -0800 |
| Subject | Why won't this run? |
| Message-ID | <ea4e1c5e-08e8-4a75-95ce-9e4eeca92021@googlegroups.com> |
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> #this program says hello and asks for my name
>>> print:('Hello world!')
Hello world!
>>> print:('What is your name?') #ask for their name
What is your name?
>>> myName = input()
print:('It is good to meet you,'+myName)
>>> print:('The length of your name is:')
The length of your name is:
>>> print:(len(myName))
39
>>> print:('What is your age?')#ask for their age
What is your age?
>>> myAge=input()
print:('You will be ' + str(int(myAge)+1)'in a year.')
>>>
[toc] | [next] | [standalone]
| From | Tim Chase <python.list@tim.thechases.com> |
|---|---|
| Date | 2015-11-15 14:55 -0600 |
| Message-ID | <mailman.353.1447621048.16136.python-list@python.org> |
| In reply to | #98859 |
On 2015-11-15 12:38, jbak36 wrote:
> Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC
> v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or
> "license()" for more information.
> >>> #this program says hello and asks for my name
> >>> print:('Hello world!')
> Hello world!
Well, for starters, you're almost certainly not copy/pasting from the
shell session as the colon after the "print" is a syntax error:
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print:('hellow world!')
File "<stdin>", line 1
print:('hellow world!')
^
SyntaxError: invalid syntax
-tkc
[toc] | [prev] | [next] | [standalone]
| From | Gary Herron <gherron@digipen.edu> |
|---|---|
| Date | 2015-11-15 12:50 -0800 |
| Message-ID | <mailman.362.1447679384.16136.python-list@python.org> |
| In reply to | #98859 |
On 11/15/2015 12:38 PM, jbak36 wrote:
> Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32
> Type "copyright", "credits" or "license()" for more information.
>>>> #this program says hello and asks for my name
>>>> print:('Hello world!')
> Hello world!
>
You are lying to us somehow. That attempt to print (as you've written
it) does not produce the the line of output you've indicated. Instead
it produces a syntax error, because Python does not use a colon in that
situation.
So change your print:(...) lines to print(...) (without the colon) and
try again. If there is further trouble, ask another question, but
please cut and paste the actual and *exact* results into the email.
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
[toc] | [prev] | [next] | [standalone]
| From | Mike S <mscir@yahoo.com> |
|---|---|
| Date | 2015-11-19 19:26 -0800 |
| Message-ID | <n2m3pf$vod$1@dont-email.me> |
| In reply to | #98859 |
On 11/15/2015 12:38 PM, jbak36 wrote:
> Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32
> Type "copyright", "credits" or "license()" for more information.
>>>> #this program says hello and asks for my name
>>>> print:('Hello world!')
> Hello world!
>>>> print:('What is your name?') #ask for their name
> What is your name?
>>>> myName = input()
> print:('It is good to meet you,'+myName)
>>>> print:('The length of your name is:')
> The length of your name is:
>>>> print:(len(myName))
> 39
>>>> print:('What is your age?')#ask for their age
> What is your age?
>>>> myAge=input()
> print:('You will be ' + str(int(myAge)+1)'in a year.')
>>> print("Hello World")
Hello World
>>> myname=input("What is your name? ")
What is your name? John
>>> print ("Your name is ", myname)
Your name is John
...you can find code samples in the *quick tutorial listed here:
https://wiki.python.org/moin/BeginnersGuide/Programmers
*http://hetland.org/writing/instant-python.html
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web