LiveWire Peer Support Network

Printable Version of Topic "Calling all programmers!"

- LiveWire Teen Forums & College Forums (http://www.golivewire.com)
-- (http://www.golivewire.com/forums/support-technical.html)
--- Programming & Application Development (http://www.golivewire.com/forums/forum-211-s-0.html)
---- Calling all programmers! (http://www.golivewire.com/forums/peer-yyppstp-support-a.html)


-- Posted by BluShift at 1:35 pm on Nov. 7, 2008

Hey everyone... I posted this question yesterday. I'm just starting to learn Python, and I'm working on a program for my IP 20 class. We were supposed to do it in QBasic, but I really can't justify learning QB, being *ahem* useless and all, so I decided to pick up a little Python.

I'm quite fluent in batch, so you can probably see that influence in here, (yes, I FLIPPED SHIT when I realized there was no "GOTO" command)

So here's my beta code for my "noteleaver" program...

# This is where I get all the important stuff imported

import os
import time
os.system("CLS")

# Splash screen start (lame I know)

print "Hello, and welcome to the..."
time.sleep(1)
print
print "     Note"
time.sleep(1)
os.system("CLS")
print "Hello, and welcome to the..."
print
print "     NoteLeaver"
time.sleep(1)
os.system("CLS")

# End of splash
# Enter name and everything

name = raw_input( 'Please enter your name: ' )
print
print "Please type your message below: "
print
mess = raw_input()
print
print
code = raw_input( "enter a passcode to lock this note: " )
print "Thank you, %s. Your note has been left" % name
time.sleep(3)
os.system("CLS")
print
print "    You have a new message from %s" % name
raw_input()
os.system("CLS")
print "This note has been locked"
print
use = raw_input( "enter the passcode to view: " )

# password system (I think it's reletively secure)

while True:
  if use == code:
      break
  os.system("CLS")
  print "That passcode is wrong. Try again."
  time.sleep(1)
  use = raw_input( "enter the passcode to view: " )
  os.system("CLS")
os.system("CLS")
print "The message is as follows:"
print "-----------------------"
print "From: %s" % name
print
print "      %s" % mess
print
print "------------------------"
raw_input( "press any key to exit" )

# End of program    

Basically, It's like leaving a little password protected sticky note on someones screen.

So if anybody took the time to go through that (yes I put the hashed comments in there just for you guys :3) I would like to know if there is anything I could do to make it "better." I realize it is fairly spaghetti. Any clever functions or easier ways to do something? Am i re-inventing the wheel?


-- Posted by Solitude at 2:15 am on Nov. 16, 2008

wtf is that?


www.golivewire.com