Python Forum
How to stop inputs on the presence of CR
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to stop inputs on the presence of CR
#11
Strange : Error on line 2.
In[1] nums = input("Write your numbers: ")
^
SyntaxError: invalid syntax

Process finished with exit code 1 . I am very new on python, so you would be very kind to correct errors. I am on python3
Reply
#12
This is the IPython interpreter
You should use only nums = input("Write your numbers: ") in your script
Same for the other lines
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#13
Many strange things. 1.PyCharm pastes badly your code..2. I dont't have to "run" your file... 3. Avarage instead of average.... The guy does not know the english language. Later, when I receive my book all will be clear. Thanks again
Reply
#14
Yes, the English is not my native language. Also, I drunk a lot of vodkas.  Cool
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#15
(Apr-16-2017, 03:11 PM)sylas Wrote: Many strange things. 1.PyCharm pastes badly your code..2. I dont't have to "run" your file... 3. Avarage instead of average.... The guy does not know the english language. Later, when I receive my book all will be clear. Thanks again

1) It is not a problem with PyCharm, what the error is telling you is Python does not know what to do with the In[1] , that is because it is a part of the interpreter being used, just as the command line interpreter uses ">>>" and "...".

>>> nums = input("Write your numbers: ")
Pasting the above code will get you the same error for the same reason.  If you are going to paste code you will have to manually remove such artifacts first, so the code becomes:

nums = input("Write your numbers: ")
Out of curiosity, which book did you order?
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
Reply
#16
Python Machine Learning [eBook] - €39.58 I ordered on packt book Since it has Hundreds of pages I hope it will be of the same interest as did the very big Alexander Allain' s "jumping in C++
Reply
#17
I come back to my old problem

my co# file7.py

def getvalue():
    value = input("enter the value ")
    print("value entered : ", value)
    if value.strip == '':
        exit(0)
    return value





size = 40
print("here is the addition of many numers (even with a .) Maximum of numbers=", size)
print("once you have finished your list of numbers, just press ENTER to indicate the end\n")
sum = 0.0
value = 0.0
count = 1
while (count != 0):
    getvalue()
    sum=sum+value
    print("sum", sum)
    count = count + 1

de here
Reply
#18
How much will you pay for anyone to agree reading this post Doh ? I will do it for 100 bucks Tongue
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#19
I agree it is illisible. But how to make that visible ? Sometimes it becomes lisible automaticaly. Strange things indeed !
Reply
#20
(Apr-20-2017, 09:20 AM)sylas Wrote: I agree it is illisible. But how to make that visible ? Sometimes it becomes lisible automaticaly. Strange things indeed !

Go into full edit mode, select all, press Remove formatting button
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Checking the presence of label using pywinauto module Malt 0 1,934 Jul-26-2019, 09:06 AM
Last Post: Malt
  [split] Check presence of a file pascale 25 11,063 Jul-08-2018, 12:23 PM
Last Post: pascale
  Check presence of a file Steffenwolt 8 5,759 May-25-2018, 07:04 AM
Last Post: Steffenwolt

Forum Jump:

User Panel Messages

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