Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,080 members, 7,957,025 topics. Date: Tuesday, 24 September 2024 at 05:03 AM |
Nairaland Forum / Science/Technology / Programming / Check Out My Python Code For Giving You The Date/time You Are Currently. (1172 Views)
Please Review My Price comparison engine / My Python Guessing Game... Pythonistas Please Come In / Please Help With My Python Shopping Cart Script (2) (3) (4)
Check Out My Python Code For Giving You The Date/time You Are Currently. by Nobody: 11:32pm On Nov 13, 2015 |
I am very new to programming; check out one of my first programs, tell me what you think, and helpe smoothen the rough edges. : """ A program for giving you information about any date and time parameter you are currently in, coded by Dee""" from datetime import datetime now = datetime.now() months = ["January","Febuary","March","April","May","June","July","August","September","October","November","December"] while True: Time = raw_input("what aspect of the time do you want to know? " Time = Time.lower() if Time == "year": print now.year elif Time == "month": print months[int(now.month)-1] elif Time == "day" and now.day !=1 and now.day !=2: print str(now.day) + "th" elif now.day == 1: print "1st" elif now.day == 2: print "2nd" elif Time == "hour": print now.hour elif Time == "minute": print now.minute elif Time == "second": print now.second else: print "I am sorry, try something else" |
Re: Check Out My Python Code For Giving You The Date/time You Are Currently. by Nobody: 11:33pm On Nov 13, 2015 |
Nairaland won't permit me to indent the code properly , the way it should be |
Re: Check Out My Python Code For Giving You The Date/time You Are Currently. by JigsawKillah(m): 1:42pm On Nov 14, 2015 |
Dapo777: if you type your codes between [code][/code] they'll indent. I'm a learner like you too. |
Re: Check Out My Python Code For Giving You The Date/time You Are Currently. by Nobody: 2:30am On Nov 15, 2015 |
JigsawKillah: Thanks pal |
(1) (Reply)
Android App Developer That No About Webservice Come In And Help / Please Help Fix My Command Line / Business Intelligence & Data Warehouse Professional Needed
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11 |