Python Forum
Absolute beginner am I missing something?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Absolute beginner am I missing something?
#1
I am just starting to learn python and I am watching a tutorial.
They are showing a basic code
name = input("what is your name" )
Print ("thank you " +  name)
When I “build” the code it says: what is your name? when I put in a word and hit enter it just jumps the cursor to the next line and lets me keep typing.
Not sure why it doesn't execute the next line.

I am using Sublime Text
when I use an online source code editor it works just fine.
Am I missing something? or dos Sublime text not do this type of compiling?
Reply
#2
If this is cut&pasted properly, it should give an error when run. Python names are case-sensitive, and your print function is capitalized.

When I run this, it generates an error. I can't see any reason that the program wouldn't accept the input and continue on after you hit Return.

Output:
what is your nameBob Traceback (most recent call last): File "caps.py", line 2, in <module> Print ("thank you " + name) NameError: name 'Print' is not defined
Reply
#3
(Sep-25-2020, 02:11 AM)bowlofred Wrote: If this is cut&pasted properly, it should give an error when run. Python names are case-sensitive, and your print function is capitalized.

When I run this, it generates an error. I can't see any reason that the program wouldn't accept the input and continue on after you hit Return.

Output:
what is your nameBob Traceback (most recent call last): File "caps.py", line 2, in <module> Print ("thank you " + name) NameError: name 'Print' is not defined

sorry I do have it as
name = input("What is your name ")
print("thank you " + name)
when I hit return it just jumps to the next line as if it was in a text document
Reply
#4
If there's an interpreter that can run the input (so that you're prompted for the name), I don't see any reason it won't continue and print.

Maybe make sure that you're seeing any output at all? Does this do something in your interpreter?

print("first line")
input("Please hit return")
print("last line")
Do you see the first line and then it goes to the last line?
Reply
#5
print("first line")
input("Please hit return")
print("last line")
I get

first line
Please hit return

if i do something like this
print("ice ")
print("cold ")
print("beer ")
sale = input ("How much beer you want")
print(sale + "beer, that right?")
print("dont matter not gona get here")
I get
ice
cold
beer
How much beer you want

If I type anything and hit enter it just jumps the cursor down

ice
cold
beer
How much beer you want
like this
.
. it never triggers the next line and never gives a run time, but I can cancel build, and it will say [Cancelled]
Reply
#6
See https://stackoverflow.com/q/31348995/4046632
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#7
(Sep-25-2020, 04:46 AM)buran Wrote: See https://stackoverflow.com/q/31348995/4046632

{ "keys": ["enter"], "command": "insert", "args": {"characters": "\n"} },
{ "keys": ["shift+enter"], "command": "insert", "args": {"characters": "\n"} },


I see this in key bindings no clue what it means
Reply
#8
both key bindings insert new line

I don't use Sublime, so I am not sure what steps you need to do in order to configure it for use as python IDE. In SO they refer to configuration file. If you don't know how to set Sublime, maybe this is a good link: https://realpython.com/setting-up-sublim...velopment/

OR

Just select different IDE like VSCode: https://python-forum.io/Thread-VS-Code-from-start
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Absolute paths in subprocess - file not found kittyticker 4 397 Jan-28-2024, 10:37 PM
Last Post: kittyticker
  automatically get absolute paths oclmedyb 1 2,061 Mar-11-2021, 04:31 PM
Last Post: deanhystad
  chkFile with absolute paths JarredAwesome 7 2,912 Sep-21-2020, 03:51 AM
Last Post: bowlofred
  absolute imports between folders mikisDW 0 1,500 Aug-05-2020, 12:26 PM
Last Post: mikisDW
  I am an absolute newbie.Help me! feynarun 4 2,439 Apr-11-2020, 09:25 PM
Last Post: feynarun
  Absolute newbie asking for help with blinking LEDs misterfrickel 0 2,033 Mar-15-2019, 08:54 AM
Last Post: misterfrickel
  Absolute Beginner Python Question matchamochi7 5 3,603 Nov-02-2018, 12:09 PM
Last Post: wookie
  Absolute Beginner to Python dthomp54 5 3,063 Oct-09-2018, 03:00 AM
Last Post: dthomp54
  Problem with absolute path to file (Mr.Stickman Problems) SheeppOSU 3 6,163 Jun-26-2018, 10:05 AM
Last Post: Larz60+
  coding error from a script (absolute noob) fuchls 2 3,856 Jun-08-2018, 02:29 PM
Last Post: webrunner1981

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020