Login Register






VERY first python program filter_list
Author
Message
VERY first python program #1
Hey guys. I, with a little help of a friend, mad my very first program using python. It is a VERY simple program that is pretty much useless, but it is a start! Smile
Here is the code for it. Please let me know what you think of it for my first code. Please dont hate on it! Smile
Code:
import datetime #Variables now = datetime.datetime.now() minute = now.minute hour = now.hour second = now.second month = now.month day = now.day year = now.year #Code user_input = raw_input ('Would you like to know date, time, or both?\n') if (user_input == 'date') : print str(month)+"/"+str(day)+"/"+str(year) if (user_input == 'time') : print str(hour)+":"+str(minute)+":"+str(second) if (user_input == 'both') : print str(month)+"/"+str(day)+"/"+str(year)+", "+str(hour)+":"+str(minute)+":"+str(second) elif (user_input != 'date') & (user_input != 'time') & (user_input != 'both') : print ('Sorry, try again.')

Reply





Messages In This Thread
VERY first python program - by LightX - 11-26-2012, 07:59 AM