Python Forum
Hello,Guys!,I met a very strange bug
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hello,Guys!,I met a very strange bug
#1
#I am learning Python now ,I have some experience about C#,VB,C.
#The scripture is very easy but I just dont know what's wrong

def eval_loop():
     while True:
        x = input('> ')
        if x== 'done':
            break
        result = eval(x)
        print (result)
eval_loop
#OK that's all code,the problem is it doesnt work, but when I delete def eval_loop(): and eval_loop then it can work.when I use debuging what ever i press F5,F6,F7(IDE Eclipse Version: Oxygen.2 Release (4.7.2)),the weird thing happen,I set break point on the line of def eval_loop():and while True: but the debuging just stop at def line dont stop at after lines until eval_loop.
#So What should I do?Please tell thanks.
Reply
#2
Please post your code in Python code tags. You can find help here.
Reply
#3
you need line8 to be
eval_loop()
i.e. you miss parenthesis to actually execute the eval_loop function
Reply
#4
What happens when you run the script in the terminal?

(Jan-26-2018, 10:06 AM)buran Wrote: you need line8 to be
eval_loop()
i.e. you miss parenthesis to actually execute the eval_loop function

I somehow missed that.

Where so many people learn to use eval with input?! Dodgy
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
Wow,thank you all you guys,I never expect there are those many people response my question.
Thank you buran,and every one wanna help me.
This is really help me to solve the problem.
ever_loop()
yeah that is exactly what I need.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  guys please help me , pycharm is not able to identify my xlsx file CrazyGreenYT7 1 2,017 Jun-13-2021, 02:22 PM
Last Post: Larz60+
  hi guys, i'm back to learning python ! astral_travel 6 2,928 Oct-05-2020, 10:02 AM
Last Post: astral_travel
  Hi Guys, please help me to write SAS macro parameter equivalent code in Python Manohar9589 2 2,594 Jun-14-2020, 05:07 PM
Last Post: Larz60+
  Could you guys help with this bug. I would post on StackOverflow but I got tempbanned ryder5227 2 2,385 Sep-26-2019, 08:01 PM
Last Post: metulburr
  Help Please guys AbuSiraj 2 2,686 Feb-14-2019, 09:29 AM
Last Post: AbuSiraj
  Hey guys, help a newbie out with a list problem. sdezigner 2 2,669 Feb-15-2018, 06:06 PM
Last Post: sdezigner
  Hey guys can you please help me with some basic coding Stabu 9 6,265 Jul-16-2017, 10:11 AM
Last Post: MyImpsNamesAre

Forum Jump:

User Panel Messages

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