LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 611 users online 192136 members 1135 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Dictionary | News | FAQ
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
4 online / 46 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic

Calling all programmers!
Replies: 1Last Post Nov. 16, 2008 2:15am by solitude
Welcome to LiveWire!
We're Stronger Together.
Join the Community
Single page for this topic Email Print Favorite
( BluShift )


Professional

Patron
Reply
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?

-------
In a world where the broken dance
on shards of glass


1:35 pm on Nov. 7, 2008 | Joined July 2008 | 65 Days Active
Join to learn more about BluShift Manitoba, Canada | GLBT Ally Male | 870 Posts | 2484 Points
solitude

Soothsayer

Patron
Reply
wtf is that?

-------
Thank you greatescape11:)
You're welcome HatesYou
click for support

2:15 am on Nov. 16, 2008 | Joined July 2008 | 109 Days Active
Join to learn more about solitude Spain | Straight Female | 11958 Posts | 11722 Points
Single page for this topic Email Print Favorite

Quick Reply

You are signed in as our guest.

Looking for something else?
 

  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic