Jump to content
Forum upgrade is live! Read more... ×
SonOfNoddy

Python Code

Recommended Posts

Hello! I was writing some python for IST (we were asked to write a flowchart as pseudocode, but I wrote it strait into python, the teacher was quit impressed), and I am getting an error that reads

Enter a number between 1 and 10Traceback (most recent call last):  
 File "/Users/swaglord/Desktop/adding code", line 1, in <module>
    one_ten = input("Enter a number between 1 and 10")EOFError: EOF when reading a line

whenever I try to get user input. The code I am using is:

dob = input("What is your birthdate?")
date = time.time()
if date > dob:
      print ("Incorrect Birth Date")
else:
      date_difference = dob - date
      print ("Your age is", date_difference)

The editor i'm using (if that makes any difference) is Sublime Text 2. Please help me in telling me what went wrong in my coding (I am still a beginner to python), I would really like to see this be working in good order.

 

Share this post


Link to post
Share on other sites

I'm going to guess that it's related to this.

 

Get used to that website, it'll probably answer the majority of your questions as a developer.

Edited by .:Cyb3rGlitch:.

Share this post


Link to post
Share on other sites

Still didn't work, I tried everything I could find online on stack exchange and other forums. Any ideas on some other code editors that I could try out?

Share this post


Link to post
Share on other sites

The only two editors I've used (and enjoyed) for coding (apart from notepad), are gVIM (windows GUI port of VIM), and the Visual Studio IDE.

Share this post


Link to post
Share on other sites

Is there a way to save the code I made as an app, terminal file or even online? Just so I don't lose the code.

Edited by SonOfNoddy

Share this post


Link to post
Share on other sites

Is there a way to save the code I made as an app, terminal file or even online? Just so I don't lose the code.

 

There is *always* a way. Even if there wasn't an in-app solution, you could copy-paste your code into a text file, dude.

Share this post


Link to post
Share on other sites

 

Is there a way to save the code I made as an app, terminal file or even online? Just so I don't lose the code.

 

There is *always* a way. Even if there wasn't an in-app solution, you could copy-paste your code into a text file, dude.

 

Ok, thanks...I feel retarded.......

Share this post


Link to post
Share on other sites

Ok, thanks...I feel retarded.......

Heh - don't worry about it. Everybody has the odd brainfart. If you're a coffee drinker (yet), have a nice brew then get back to it.

  • Like 1

Share this post


Link to post
Share on other sites

Pastebin?

 

Or Dropbox

Does dropbox have an inbuilt code storage?

 

 

Ok, thanks...I feel retarded.......

Heh - don't worry about it. Everybody has the odd brainfart. If you're a coffee drinker (yet), have a nice brew then get back to it.

 

Don't drink coffee, MOUNTAIN DEW ALL THE WAY!!! Nah, I just drink water, juice and hot chocolate, I prefer water over any drink to be honest.

Share this post


Link to post
Share on other sites

I store code in dropbox. I have a folder I place text files in for access on any machine or device.

Share this post


Link to post
Share on other sites

Nope nope nope nope nope!

 

Learn how to version control your software properly. Sign up for Bitbucket (or Github) and learn how to use Git. You'll thank me later. Here's a handy tutorial once you've read up on what Git is.

Edited by .:Cyb3rGlitch:.
  • Like 2

Share this post


Link to post
Share on other sites

Learn how to version control your software properly. Sign up for Bitbucket (or Github) and learn how to use Git. You'll thank me later. Here's a handy tutorial once you've read up on what Git is.

 

He didn't say he wanted to version it - just backup the source. IMO, Git is massive overkill for that, and way more complex than necessary.

Share this post


Link to post
Share on other sites

 

Learn how to version control your software properly. Sign up for Bitbucket (or Github) and learn how to use Git. You'll thank me later. Here's a handy tutorial once you've read up on what Git is.

 

He didn't say he wanted to version it - just backup the source. IMO, Git is massive overkill for that, and way more complex than necessary.

 

 

Using Git to store a simple file is probably the best way to learn. It's a simple process and gets you set up for when you have a larger project.

Share this post


Link to post
Share on other sites

 

Using Git to store a simple file is probably the best way to learn. It's a simple process and gets you set up for when you have a larger project.

 

... Well, yeah, I guess as a learning exercise it makes sense. Still seems a bit like taking pyrochemistry courses to learn how to make propellants when all you want to do is go shooting.

Share this post


Link to post
Share on other sites

... Well, yeah, I guess as a learning exercise it makes sense. Still seems a bit like taking pyrochemistry courses to learn how to make propellants when all you want to do is go shooting.

 

Not really, since it almost never makes sense to store code outside a repository.

Share this post


Link to post
Share on other sites

 

... Well, yeah, I guess as a learning exercise it makes sense. Still seems a bit like taking pyrochemistry courses to learn how to make propellants when all you want to do is go shooting.

 

Not really, since it almost never makes sense to store code outside a repository.

 

 

"Why on Earth would anyone need to shoot anything if they're not going to war? And then they're damned well going to need to know how to make powder!"

 

Sometimes, ya just want to go plinking, ya know? I know I have a dozen or so small personal project sources stashed away; nobody needs to see them - probably not even me any more. But they're there in case I get nostalgic for Pascal... or have another brain tumour. ;p

Share this post


Link to post
Share on other sites

I get what you're saying, but it's a bad habit to get into. If you start with trivial projects then you're prepared when you want to move onto bigger and better things. Sometimes little hack projects end up morphing into larger projects too. Version control is one of those things that saves you time in the long run, and people always kick themselves for not learning it sooner.

  • Like 2

Share this post


Link to post
Share on other sites

aah fucking GitHub...

 

ya know, theres a few things on the net that make me feel proper retarded. heres a short list of really embarrassing admissions:

 

- although i read Reddit a damn lot these days, i still have N.F.I. how to navigate it properly

- i NEVER understood how to use Slashdot at all -- although it seems i havent been there in ages

- whenever i follow a 'helpful' link to GitHub where i can 'find the latest build' of whatever, my inner dialogue usually goes like this: "err....um...wheres the...is this the...no thats...gah! where is ANYTHING here?...what in the actual fuck is going on?....have i had a stroke?....do i even know how to use a computer anymore?..." <closes tab> (i know right :S)

 

anyway...if you are just a fledgling coder working alone, is learning to use GitHub advisable primarily because you might one day intend to manage collaboration, or is it like amazing for managing your own shit too? because i would have thought a simple taxonomy of carefully named local files and folders should be more than enough for source files that dont add up to terrabytes.

Edited by @~thehung
  • Like 2

Share this post


Link to post
Share on other sites

i would have thought a simple taxonomy of carefully named local files and folders should be more than enough for source files that dont add up to terrabytes.

 

Well, I can't relate to your reddit problem (intuitive for me), and I never did get into Slashdot, but I agree with you about Git.

 

Maybe it's just that there was no such thing when I was learning - everything was down to my own ability to make a naming scheme and directory structure, and keep archives. Maybe it's that cloud storage still seems to me like a Really Bad Idea. <shrug> Not a problem I have to deal with any more.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×