First code!

Discussion in 'Miscellaneous' started by Gibabyte, May 24, 2014.

?

Impressive?

Yes 8 vote(s) 100.0%
Not a chance 0 vote(s) 0.0%
  1. Hello everyone, it is boozle again! I have finally gotton into coding and am completely addicted!. Is that a good thing?

    Anyways, I spent 7 hours writing this python program which calculates pi... It is still a work in progress, and I have no prior experience with coding, so don't judge. >.>

    Code:
    def add(val):
    	val += 2
    #def add(val):
    	#val = val + 2
    	
    	return val
    	
    	#x += 2
    	
    	# Not sure if this will work when called from another command line.
    	
    	
    	
    def somecommandline(): # Defines the actual main part of the program
    
    
    
    	# says how much "x starts off as"
    	x = 1.0
    		
     
    	# says how to start the process
    	uf = 4 / x
    	print 'Success! Just wait...'
    	for i in range(0,1000000):
    
    		x=add(x)
    		unfin = uf - 4 / x
    		x=add(x)
    		fin = unfin + 4 / x
    	
    	
    		#print '==='
    		#print fin
    	
    		#print int(fin)
    	
    		uf = fin
    	
    	
    	print '========================'
    	print fin
    	
    	
    	
    somecommandline()
    FDNY21 likes this.
  2. You misspelled a word. jk, good luck with coding!
  3. I'm still learning JavaScript >_>
  4. Impressive, yes. How can I use this?
  5. Gah, the lack of semicolons.

    But still, pretty good :D and it's not bad that you're addicted, I am too :p
  6. Me three. I'm the only guy in my class who messes with JavaScript during computer. Probably cuz I'm the only guy in my class who knows how :p