Jump to content


Photo

Python Code

python coding

  • Please log in to reply
32 replies to this topic

#1 SonOfNoddy

SonOfNoddy

    Snotblock

  • Atomican
  • 639 posts
  • Location:Sydney

Posted 03 February 2015 - 05:46 PM

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.

 


Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

#2 .:Cyb3rGlitch:.

.:Cyb3rGlitch:.

    Hero

  • Mod
  • 21,363 posts

Posted 03 February 2015 - 07:28 PM

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:., 03 February 2015 - 07:28 PM.

"We are a way for the cosmos to know itself." - Carl Sagan
"I do not fear death. I had been dead for billions and billions of years before I was born, and had not suffered the slightest inconvenience from it." - Mark Twain
 
An open mind is willing to consider new ideas, while provisionally accepting those backed by empirical evidence, and provisionally rejecting those without.


#3 SonOfNoddy

SonOfNoddy

    Snotblock

  • Atomican
  • 639 posts
  • Location:Sydney

Posted 19 February 2015 - 07:46 AM

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?


Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

#4 Nich...

Nich...

    Professional Tart

  • Mod
  • 42,964 posts
  • Location:Mexico

Posted 19 February 2015 - 04:58 PM

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.
"I think it is a sad reflection on our civilization that while we can and do measure the temperature in the atmosphere of Venus we do not know what goes on inside our soufflés" -- Nicholas Kurti

#5 .:Cyb3rGlitch:.

.:Cyb3rGlitch:.

    Hero

  • Mod
  • 21,363 posts

Posted 19 February 2015 - 08:17 PM

Or just use an online REPL since it's Python.

 

http://repl.it/languages/Python3


"We are a way for the cosmos to know itself." - Carl Sagan
"I do not fear death. I had been dead for billions and billions of years before I was born, and had not suffered the slightest inconvenience from it." - Mark Twain
 
An open mind is willing to consider new ideas, while provisionally accepting those backed by empirical evidence, and provisionally rejecting those without.


#6 SonOfNoddy

SonOfNoddy

    Snotblock

  • Atomican
  • 639 posts
  • Location:Sydney

Posted 20 February 2015 - 08:34 AM

Looks, pretty good. Is there an offline version of the program?


Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

#7 .:Cyb3rGlitch:.

.:Cyb3rGlitch:.

    Hero

  • Mod
  • 21,363 posts

Posted 20 February 2015 - 03:58 PM

Nope, but it's good enough to practise bits and pieces while you sort out your problem.


"We are a way for the cosmos to know itself." - Carl Sagan
"I do not fear death. I had been dead for billions and billions of years before I was born, and had not suffered the slightest inconvenience from it." - Mark Twain
 
An open mind is willing to consider new ideas, while provisionally accepting those backed by empirical evidence, and provisionally rejecting those without.


#8 SonOfNoddy

SonOfNoddy

    Snotblock

  • Atomican
  • 639 posts
  • Location:Sydney

Posted 20 February 2015 - 04:42 PM

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, 20 February 2015 - 04:43 PM.

Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

#9 Cybes

Cybes

    Titan

  • Atomican
  • 17,681 posts
  • Location:Where I am

Posted 20 February 2015 - 06:00 PM

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.


"Reality does not care what you think." - Dr Richard Feynman
"Ideas do not deserve respect.- people do." - Peter Boghossian (paraphrase)


#10 SonOfNoddy

SonOfNoddy

    Snotblock

  • Atomican
  • 639 posts
  • Location:Sydney

Posted 20 February 2015 - 06:10 PM

 

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.......


Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

#11 Nich...

Nich...

    Professional Tart

  • Mod
  • 42,964 posts
  • Location:Mexico

Posted 20 February 2015 - 08:17 PM

Pastebin?

Or Dropbox
"I think it is a sad reflection on our civilization that while we can and do measure the temperature in the atmosphere of Venus we do not know what goes on inside our soufflés" -- Nicholas Kurti

#12 Cybes

Cybes

    Titan

  • Atomican
  • 17,681 posts
  • Location:Where I am

Posted 20 February 2015 - 08:21 PM

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.


"Reality does not care what you think." - Dr Richard Feynman
"Ideas do not deserve respect.- people do." - Peter Boghossian (paraphrase)


#13 SonOfNoddy

SonOfNoddy

    Snotblock

  • Atomican
  • 639 posts
  • Location:Sydney

Posted 20 February 2015 - 08:27 PM

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.


Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

#14 Nich...

Nich...

    Professional Tart

  • Mod
  • 42,964 posts
  • Location:Mexico

Posted 20 February 2015 - 08:37 PM

I store code in dropbox. I have a folder I place text files in for access on any machine or device.
"I think it is a sad reflection on our civilization that while we can and do measure the temperature in the atmosphere of Venus we do not know what goes on inside our soufflés" -- Nicholas Kurti

#15 SonOfNoddy

SonOfNoddy

    Snotblock

  • Atomican
  • 639 posts
  • Location:Sydney

Posted 20 February 2015 - 10:22 PM

Would I be able to do the same with One Drive?


Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

#16 Nich...

Nich...

    Professional Tart

  • Mod
  • 42,964 posts
  • Location:Mexico

Posted 20 February 2015 - 10:24 PM

Sure. Whatever is accessible to you in the places you need access.
"I think it is a sad reflection on our civilization that while we can and do measure the temperature in the atmosphere of Venus we do not know what goes on inside our soufflés" -- Nicholas Kurti

#17 .:Cyb3rGlitch:.

.:Cyb3rGlitch:.

    Hero

  • Mod
  • 21,363 posts

Posted 20 February 2015 - 11:23 PM

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:., 20 February 2015 - 11:24 PM.

"We are a way for the cosmos to know itself." - Carl Sagan
"I do not fear death. I had been dead for billions and billions of years before I was born, and had not suffered the slightest inconvenience from it." - Mark Twain
 
An open mind is willing to consider new ideas, while provisionally accepting those backed by empirical evidence, and provisionally rejecting those without.


#18 Cybes

Cybes

    Titan

  • Atomican
  • 17,681 posts
  • Location:Where I am

Posted 20 February 2015 - 11:44 PM

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.


"Reality does not care what you think." - Dr Richard Feynman
"Ideas do not deserve respect.- people do." - Peter Boghossian (paraphrase)


#19 .:Cyb3rGlitch:.

.:Cyb3rGlitch:.

    Hero

  • Mod
  • 21,363 posts

Posted 20 February 2015 - 11:59 PM

 

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.


"We are a way for the cosmos to know itself." - Carl Sagan
"I do not fear death. I had been dead for billions and billions of years before I was born, and had not suffered the slightest inconvenience from it." - Mark Twain
 
An open mind is willing to consider new ideas, while provisionally accepting those backed by empirical evidence, and provisionally rejecting those without.


#20 Cybes

Cybes

    Titan

  • Atomican
  • 17,681 posts
  • Location:Where I am

Posted 21 February 2015 - 12:04 AM

 

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.


"Reality does not care what you think." - Dr Richard Feynman
"Ideas do not deserve respect.- people do." - Peter Boghossian (paraphrase)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users