Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Newbie help with simple script written for v3.3 and used on vs2.7, please?
#1
Hi
Im a complete newbie to any sort of programming so sorry if this is a stupid question - working my way through the python for absolute beginers on you tube and Im on Video2. Have got python running from cmd and using notepad++ for editor.  Code reads    
print("hello world")     
myName = input("what is your name?")     
print(myName)
above runs fine outputting
Output:
hello world what is your name?
Video shows typing your name after the ?  (no space)  pressing enter key and then name should print  however I get an error message basically saying Name error Name Paul is not defined. 
I think video uses v3.3 and Im on 2.7 dont know if that makes a difference but any help welcome.  Thanks for reading.
Thanks
Paul
Quote
#2
Works fine under 3.5.1
Quote
#3
Thanks for the response I was wondering if the reason was I`m using 2.7 and Video is 3.3.  I may install V3 and see if that works.

Thanks again

Just a quick update installed V3.3 and code now runs fine.

Thanks everybody for reading - I`m sure I will have more questions soon.

On that note anybody know any good online tutorials/videos etc?  or know a good book for complete novice?   Looked at Python programming for the absolute beginner by Mike Dawson on Amazon for around £16 has anyone used this book?

Cheers
Paul
nilamo likes this post
Quote
#4
instead of "input()" you should use "raw_input()"

myName = raw_input("what is your name?")  
and instead of "print()", you can just use "print var "

print myName
there were some other changes from v2 to v3, but these two are probably used most often

As to resources, check this link Python Resources
nilamo likes this post
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Quote
#5
(Dec-08-2016, 07:46 PM)PaulMorrey Wrote: Thanks everybody for reading - I`m sure I will have more questions soon.

On that note anybody know any good online tutorials/videos etc?  or know a good book for complete novice?  

Well then welcome to programming and our forums, Paul.

You can take a look at our (long) list here in the Tutorials sub-forum: A List of Free Python Resources
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Made a simple script for android (really simple) but it is not running anddontyoucomebacknomore 2 419 Mar-06-2019, 12:19 AM
Last Post: anddontyoucomebacknomore
  Newbie Ubuntu script problem Kloontor 6 683 Sep-24-2018, 03:51 PM
Last Post: Kloontor
  Simple script that seems to misbehave? Nwb 1 495 Jun-10-2018, 05:30 AM
Last Post: Nwb
  First time with Python.. need help with simple script shakir_abdul_ahad 7 1,862 May-06-2018, 09:28 AM
Last Post: killerrex
  help with a simple script juanb007 4 924 May-01-2018, 08:06 PM
Last Post: ThiefOfTime
  Run Script written in javascript from python Scientifix 3 842 Apr-28-2018, 06:48 PM
Last Post: Gribouillis
  Simple script writted by a dumb dude, myself mm14ag 2 623 Apr-28-2018, 11:48 AM
Last Post: mm14ag
  1st Script written doesn't output anything. Need some else's eyes Kym 3 876 Mar-21-2018, 04:19 PM
Last Post: nilamo
  Need help with a simple AHK script Stabu 0 641 Feb-24-2018, 08:27 PM
Last Post: Stabu
  A simple script - looking for feedback glidecode 2 693 Feb-20-2018, 11:18 PM
Last Post: glidecode

Forum Jump:


Users browsing this thread: 1 Guest(s)