-  [WT]  [PS]  [Home] [Manage]

Posting mode: Reply
  1.   (reply to 5139)
  2. (for post and file deletion)
/pr/ - Programming
  • Supported file types are: C, CSS, DOC, DOCX, GIF, H, JAVA, JPG, PDF, PNG, SVG, SWF, TXT, WEBM
  • Maximum file size allowed is 10000 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 429 unique user posts. View catalog

  • Blotter updated: 2018-08-24 Show/Hide Show All

We are in the process of fixing long-standing bugs with the thread reader. This will probably cause more bugs for a short period of time. Buckle up.

Movies & TV 24/7 via Channel7: Web Player, .m3u file. Music via Radio7: Web Player, .m3u file.

WebM is now available sitewide! Please check this thread for more info.

PY Lord of the sneks 18/09/25(Tue)22:59 No. 5139

File 153790916925.jpg - (96.23KB , 690x678 , 1537307044830.jpg )

Python general bread, all are welcome, lets revive this board boys

Neckbearded Basement Dweller 18/09/26(Wed)00:34 No. 5140

Been so long since I coded in Python. What are some decent resources to get me back into it?

Lord+of+the+sneks 18/09/26(Wed)21:22 No. 5142

Hey, I'm currently learning python too, the two best resources I know of that are available for free are w3 schools and codeacademy, they're both great for learning.

On another note, was wondering if anyone could give me a hand, I'm trying to make it so that the variables "name" "year" and "age" are logged in a text file, with a timestamp of when they where saved.

name = input("Please enter your name: ")
year = int(input("Please input the year that you were born: "))

age = 2018 - year

while age == 0:
x = int(input("Age is incorrect, please try again."))
age = 0
age += x

print("Hello ",name,", you were born in the year ",year,)
print("I predict that you are ",age," years old.")
ageright = input("Is this correct? Press y or n to decide.")
if ageright == "y":

if ageright == "n":
age -= 1
print("Oops! You must be ",age," years old instead!")

fact = input("Press Y for an interesting fact about your age: ")

if fact == "y":
print("Since most humans sleep for about a third of their life, that means that you have slept for a total of ",age/3," years.")

print("Thank you for using the program.")

Lord+of+the+sneks 18/09/26(Wed)23:30 No. 5143

I've found the solution to this problem, for those wondering, it looks something like this:

with open("details.txt","a") as output:
output.write("Age: {} Name: {} Year: {} Timestamp: {}".format(age,name,year,datetime.datetime.now()))

Neckbearded Basement Dweller 18/09/30(Sun)00:45 No. 5144

This is tight. I honestly didn't know an answer to your request (though your original code was pretty fluid) how'd you find the answer? Lack of sleep and caffeine until 5pm like the rest of us?

[Return] [Entire Thread] [Last 50 posts]

Delete post []
Report post