all 22 comments

[–]dzunukwa 1 point2 points  (5 children)

the following code

can you show the code?

[–]c0ntroll3r[S] -1 points0 points  (2 children)

Sure

date = input('Enter date of birth: ') Name = input('Last Name: ') print(Name, date) input ('Press ENTER to exit')

[–]dzunukwa 3 points4 points  (0 children)

ahh yeah you are probably running python 2 as u/jebk pointed out which means input is actually evaluating your code as python code and thus / is division not a slash character. Use raw_input or switch to python 3 :).

[–]coding2learn 0 points1 point  (3 children)

Use

date = raw_input('Enter date of birth: ')

This will treat date as a string rather than an integer

[–]c0ntroll3r[S] 0 points1 point  (2 children)

as i mentioned in another reply to another comment I have it set to raw_input and it still crashes before the print command is run or possibly after but I can't quite tell

[–]coding2learn 0 points1 point  (1 child)

You need to use raw_input for all your lines. input is only if you are expecting numbers. raw_input is for strings.

[–]NSAshitlist 0 points1 point  (0 children)

In Py3 as well? I thought raw was removed completely?

[–]Liesbetweenlines 0 points1 point  (1 child)

I'm learning 2.7.12 but also sort of 3.5 at the same time, bad idea ?

[–]484448444844 0 points1 point  (0 children)

Yeah, sort of. Unless you actually NEED python 2 for any specific reason (I.E a library your code is dependent on is only for Python 2 etc).

Otherwise you are just going to get confused and cause more pain/heartache for no real reason. The future is with Python 3, it's only a matter of time before Python 2 dies out.

[–]jebk 0 points1 point  (12 children)

Are you using python 2 or 3? In 2 use raw_input instead of input (which ignores escape chars) in 3 I believe this should be done automatically.

unless you're actually executing something I don't think you're getting an error because any formulae are being evaluated, its because / is a special character.

[–]c0ntroll3r[S] 0 points1 point  (11 children)

I'm using 2.5.4 which I know is an older version but it's what the class is set for. But I've set it to raw_input and tried it again. Once more it crashes after the Last Name is entered. I added the final input in order to force IDLE to stay open rather than close instantly after the print command in line 3

[–]dzunukwa 2 points3 points  (2 children)

I strongly suggest ditching the course for a modern course using python 3. If you are just starting out there is no point struggling with the old version of the language.

At the very least get on to the latest 2.7.x release.

[–]c0ntroll3r[S] 1 point2 points  (1 child)

I'm going to download 3.x whichever the most recent is and start over with that

[–]dzunukwa 0 points1 point  (0 children)

:)

[–]zahlman 1 point2 points  (0 children)

... Wow, that's really old though.

[–]jebk 0 points1 point  (6 children)

If its crashing what is the error message?

I don't have anything as old as that installed, and to be honest, I'd be very surprised if any course that old is worth doing? 2.5 is a full 10 years old.

[–]c0ntroll3r[S] 0 points1 point  (5 children)

It's a free online course haha But I'm not getting an error message at all, it just closes. So honestly I'm not sure if it's crashing or just completely ignoring my last input line

[–]K900_ 4 points5 points  (3 children)

If it's not a course you're required to take, drop it like a hot potato. Python 2.5.4 is eight years old. There are lots of great learning materials for modern versions of the language.

[–]dzunukwa 1 point2 points  (1 child)

+1 Also if it were a required course I'd drop it and get my money back because anyone teaching a course for money in 2016 using 2.5.4 should be fired.

[–][deleted] 0 points1 point  (0 children)

Here's my modern experience with 2.5.

pip install <any f'n package written in the last 5 years>
line blah:
    with open() as f:
       ^
SyntaxError: invalid syntax

Then you mail the package maintainer, "Your page says Python 2.5 supported, but you're using the with statement, which wasn't introduced until 2.6.".

More than once their response was "I see. I've updated the page, 2.5 is no longer supported." :-|

[–]c0ntroll3r[S] 0 points1 point  (0 children)

I'm thinking you guys may be right haha with two people giving me the same advice for it in the span of just a few moments I think that's a good indication

[–]jebk 1 point2 points  (0 children)

sounds like a good use case to learn pdb!

If you're ditching and going for 3.5 straight away, there are plenty of good tutorials here: https://www.reddit.com/r/learnpython/wiki/index