Python Forum
Absolute beginner am I missing something? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Absolute beginner am I missing something? (/thread-29893.html)



Absolute beginner am I missing something? - kamren - Sep-25-2020

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?


RE: Absolute beginner am I missing something? - bowlofred - Sep-25-2020

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



RE: Absolute beginner am I missing something? - kamren - Sep-25-2020

(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


RE: Absolute beginner am I missing something? - bowlofred - Sep-25-2020

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?


RE: Absolute beginner am I missing something? - kamren - Sep-25-2020

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]


RE: Absolute beginner am I missing something? - buran - Sep-25-2020

See https://stackoverflow.com/q/31348995/4046632


RE: Absolute beginner am I missing something? - kamren - Sep-25-2020

(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


RE: Absolute beginner am I missing something? - buran - Sep-25-2020

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-sublime-text-3-for-full-stack-python-development/

OR

Just select different IDE like VSCode: https://python-forum.io/Thread-VS-Code-from-start