My first program!

This is the place to post any code that you want to share with the community. Only completed scripts should be posted here.

My first program!

Postby SlickStretch » Wed Apr 30, 2014 1:37 pm

Well, I guess this is technically my 2nd program in python. My 1st was the standard "Hello world." program. But this is the first program I made from scratch. This is after about 5 hours with python. So far, I'm really liking python! :D

This is a program I use to calculate my insulin dose.

Code: Select all
#NDC - Novolog Dosage Calculator
#By SlickStretch
#myemailaddress
#April 29, 2014

print "Novolog Dosage Calculator by SlickStretch"
print "WARNING: THIS PROGRAM IS DESIGNED FOR SLICKSTRETCH ONLY."
print "YOUR INSULIN DOSE IS PROBABLY NOT THE SAME."
BG = int(raw_input("Enter Blood Glucose (mg/dL): "))
correction = (BG - 150) / 50
correction = max(0, correction)
carbs = int(raw_input("How many carbs are you about to eat? "))
bolus = carbs / 10
total_dose = correction + bolus
print "You need to take {} units.".format(total_dose)
print "({} to correct for high blood sugar, and {} to cover your food.)".format(correction, bolus)
raw_input("Press enter to exit.")
print "END PROGRAM"
Last edited by stranac on Wed Apr 30, 2014 3:52 pm, edited 2 times in total.
Reason: First post lock. Removed email address from code
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
SlickStretch
 
Posts: 3
Joined: Wed Apr 30, 2014 12:27 pm
Location: Oregon

Re: My first program!

Postby Kebap » Wed Apr 30, 2014 2:37 pm

Great job, welcome on board! :)

You may want to remove your email address though, unless you'd like some spam from address-harvesting robots, etc. :geek:

To the next 5 hours!
Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 366
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: My first program!

Postby metulburr » Wed Apr 30, 2014 2:46 pm

:)
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1312
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: My first program!

Postby SlickStretch » Wed Apr 30, 2014 3:05 pm

Kebap wrote:Great job, welcome on board! :)

You may want to remove your email address though, unless you'd like some spam from address-harvesting robots, etc. :geek:

To the next 5 hours!


Good idea. However, I can't edit the post. There is no edit button, and at the bottom it says "First post lock." Oh, well. Gmail's spam filters work pretty well for me.
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
SlickStretch
 
Posts: 3
Joined: Wed Apr 30, 2014 12:27 pm
Location: Oregon

Re: My first program!

Postby stranac » Wed Apr 30, 2014 3:58 pm

SlickStretch wrote:Good idea. However, I can't edit the post. There is no edit button, and at the bottom it says "First post lock."

Taken care of by our amazing admin.
The first post lock thing is something we agreed to always do, although I never thought it was really needed...
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1093
Joined: Thu Feb 07, 2013 3:42 pm

Re: My first program!

Postby micseydel » Wed Apr 30, 2014 8:34 pm

stranac wrote:I never thought it was really needed...

It's definitely needed some of the time, but it seems that we all just do it always. At least no one will complain about us being impartial, right? ;)

Also, welcome SlickStretch! I love seeing non-engineers use programming to solve day-to-day problems in their lives!
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
micseydel
 
Posts: 1128
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: My first program!

Postby SlickStretch » Thu May 01, 2014 7:54 am

stranac wrote:Taken care of by our amazing admin.


Thank you. :)
Join the #python-forum IRC channel on irc.freenode.net!
User avatar
SlickStretch
 
Posts: 3
Joined: Wed Apr 30, 2014 12:27 pm
Location: Oregon


Return to Completed Scripts

Who is online

Users browsing this forum: No registered users and 2 guests