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
    Senior Member
    Join Date
    Jan 2003
    Posts
    3,915
    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.

  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. Read Me First
    By Negative in forum The Security Tutorials Forum
    Replies: 12
    Last Post: June 2nd, 2004, 01:09 AM
  2. 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, 05:28 PM
  3. multi question
    By hexadecimal in forum AntiOnline's General Chit Chat
    Replies: 10
    Last Post: September 13th, 2003, 02:43 AM
  4. 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
  •