Python Syntax Question
Results 1 to 5 of 5

Thread: Python Syntax Question

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    4

    Python Syntax Question

    if shape == 1
    height = input("Please enter the height")
    width = input("Please enter the width")
    area = height*width
    print "The area is", area
    else:
    radius = input("Please enter the radius")
    area = 3.14*(radius**2)
    print "The area is", area

    This is the part I get an syntax error with, any ideas?

    Thanks in advance

  2. #2
    Junior Member
    Join Date
    Mar 2009
    Posts
    4
    No answers yet? Is this a programming/hacking site or what?

    Could someone point me to a better forum for these type question please?

  3. #3
    Super Moderator
    Know-it-All Master Beaver

    Join Date
    Jan 2003
    Posts
    3,914
    That second post was definitely unnecessarily snappy.

    There are problems with your code, but they could also be problems on the use side

    Issues:

    1) No ':' at the end of your if statement
    2) No use of whitespace to indicate code sections.

    Potential user issue:

    1) input will only accept numeric entries. If the person typed a letter, a syntax error would be thrown.
    IT Blog: .:Computer Defense:.
    PnCHd (Pronounced Pinched): Acronym - Point 'n Click Hacked. As in: "That website was pinched" or "The skiddie pinched my computer because I forgot to patch".

  4. #4
    Junior Member
    Join Date
    Mar 2009
    Posts
    4
    Sorry for being snappy

    Thanks it was just a simple :!

    The whitespace problem was due to the cut & paste.

    Whats a good site to cut & paste code/save it etc?

  5. #5
    Banned
    Join Date
    Jan 2008
    Posts
    605
    Quote Originally Posted by cranoo View Post
    Sorry for being snappy

    Thanks it was just a simple :!

    The whitespace problem was due to the cut & paste.

    Whats a good site to cut & paste code/save it etc?
    Code:
    This?

Similar Threads

  1. A Guide to AntiOnline and the world of security.
    By Ennis in forum Newbie Security Questions
    Replies: 14
    Last Post: May 26th, 2011, 01:49 AM
  2. Read Me First
    By Negative in forum The Security Tutorials Forum
    Replies: 12
    Last Post: June 2nd, 2004, 01:09 AM
  3. A Guide to AntiOnline and the world of security.
    By Ennis in forum AntiOnline's General Chit Chat
    Replies: 5
    Last Post: December 27th, 2003, 04:28 PM
  4. multi question
    By hexadecimal in forum AntiOnline's General Chit Chat
    Replies: 10
    Last Post: September 13th, 2003, 02:43 AM
  5. Test Your Knowledge of Redhat?
    By smirc in forum AntiOnline's General Chit Chat
    Replies: 3
    Last Post: May 13th, 2002, 03:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides