Jump to content

New To Python- Little Program i made.

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
24 replies to this topic

#1
Aaron.H

Aaron.H

    Learning Programmer

  • Members
  • PipPipPip
  • 30 posts
Hey, i'm new to this forum, my name is Aaron i am 14 and i am an aspiring programmer; i am starting with python, i've been looking around the forum and i want this to be forum to be my "online programming home"
people look pretty nice here, so heres a little program i made to calculate the area of a triangle and a sqaure.

print "Please input the information about your rectangle"

length = input ("Length: ")

width = input ("Width: ")

print "Area", length * width

print "Perimeter", 2 * length + 2 * width

print "Area of the triangle", length * width / 2

print "Perimetre of the triangle is", 2* length + 2 * width / 2

user_input = raw_input ("Hope you enjoy, what is your name?")

print "Oh, ok", user_input

i'm new to python, tell me what you think :)

#2
Donovan

Donovan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 798 posts
Cool, I am 14 also man and welcome to CodeCall. Yea I just joined today also they are very nice people. Good to see people my age join the programming forums:D
Posted Image
+Friend Me | My Graphics | Forum Rules | Help Forum | Forum FAQ

#3
Aaron.H

Aaron.H

    Learning Programmer

  • Members
  • PipPipPip
  • 30 posts
Haha maybe we could work on Python app one day?:)

#4
Donovan

Donovan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 798 posts
Hey, you look like you know some stuff. I could use some help. Got an Instant Messenger? I think it would be good for two beginners to work together. We could start our own little coding team. I have an MSN if you would like to talk now I am free:)
Posted Image
+Friend Me | My Graphics | Forum Rules | Help Forum | Forum FAQ

#5
Aaron.H

Aaron.H

    Learning Programmer

  • Members
  • PipPipPip
  • 30 posts
Okay, cool but im a real newbie at python. Im just reading alot :) pm me your msn.

#6
Donovan

Donovan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 798 posts
Alright:)
Posted Image
+Friend Me | My Graphics | Forum Rules | Help Forum | Forum FAQ

#7
Donovan

Donovan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 798 posts
Hehe, Sorry for double post but I need 1 more post to PM you so.. Here:) I am sure the admin won't mind.

10 Post:)
Posted Image
+Friend Me | My Graphics | Forum Rules | Help Forum | Forum FAQ

#8
Aaron.H

Aaron.H

    Learning Programmer

  • Members
  • PipPipPip
  • 30 posts
added :)

#9
Brandon W

Brandon W

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,828 posts
Seems like two new members have got together and got same plans underway :D

Also this is source code and should be posted in that section. But that is some nice code mate! I wouldn't mind learning Python eventually.

One thing I have noticed is this.
print "Area", length * width

You did it with all your prints. You think about this. You are printing area and then length * width so the output will be this, if you use 5 as the length and 10 as the width.
Area50

To fix this put a space after Area but before the speech mark and it should work fine.

Also welcome to CC both of use :D
jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation

Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!


#10
manux

manux

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 234 posts
Brandon, In python the print statement receives a tuple and separates each element with a space
(" ")
So: print "Hi","I am","A Chicken"
will output "Hi I am A Chicken"
and not "HiI amA Chicken"

True you should learn Python eventually, its a great language!

Good luck!

#11
Donovan

Donovan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 798 posts
Erm, It is more like these.

print "Hi I am a chicken"
output: Hi I am a chicken

print "Hi " + "I " + "am " + "a " + "chicken"
output: Hi I am a chicken

print "Hi",
print "I am a chicken"
output: Hi I am a chicken

output = "Hi I am a chicken"
print output
output Hi I am a chicken

print "\"Hi I am a chicken\""
output: "Hi I am a chicken"

so on.... Those are the proper ways to print the words Hi I am a chicken.
Posted Image
+Friend Me | My Graphics | Forum Rules | Help Forum | Forum FAQ

#12
Brandon W

Brandon W

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,828 posts
Oh OK thanks manux. I don't know Python as of yet :)