Jump to content


Photo
- - - - -

Confused with programming...


  • Please log in to reply
10 replies to this topic

#1 Cr4X

Cr4X

    elite

  • Members
  • 120 posts

Posted 02 June 2003 - 02:27 PM

I am working with the simple programming langue Python. Duh i have some problems understanding the difference between = and ==, * and ** etc. What is the difference?

Thanks in advance.

#2 White_Raven

White_Raven

    That's so raven!

  • Banned
  • 1,597 posts

Posted 02 June 2003 - 02:37 PM

= is the asignment operator, as in "foo = bar" means "foo equals bar", and == is a comparison operator, as in "foo == bar" means "foo is equal to bar", and if the one to use in if-then statments and such.. the first simple tells the computer to take one value either form a varible or raw value and stick it into the var, the second is used to test if they are equal.

You get this in other languages as well, like in C, C++ and the like.

That help you at all?

#3 ChZ

ChZ

    SUP3R 31337

  • Members
  • 150 posts

Posted 02 June 2003 - 02:41 PM

* is multiply. ** raises a number to a power

#4 Cr4X

Cr4X

    elite

  • Members
  • 120 posts

Posted 02 June 2003 - 03:42 PM

So foo = bar means just the same as
height = input("Please enter the height: ")
and foo == bar is the same as 2+2==4?

#5 White_Raven

White_Raven

    That's so raven!

  • Banned
  • 1,597 posts

Posted 02 June 2003 - 06:41 PM

Correct, The following C code should provide another example
int foo = 2 + 2;
int bar = 4;
if (foo == bar){
printf("foo is equal to bar\n");
}
else{
printf("foo is not equal to bar, and your computer is f*cked.");
}


#6 Cr4X

Cr4X

    elite

  • Members
  • 120 posts

Posted 03 June 2003 - 03:46 PM

Thanks a lot for your help :D

#7 phax

phax

    SUP3R 31337

  • Members
  • 187 posts

Posted 03 June 2003 - 07:18 PM

Hey! Cr4x, When U think U have python down go and get a account on Google and play with their api's. Have fun

#8 White_Raven

White_Raven

    That's so raven!

  • Banned
  • 1,597 posts

Posted 04 June 2003 - 01:01 AM

nb, Just glad I could help.

#9 FLuXx

FLuXx

    the 0ne

  • Members
  • 1 posts

Posted 06 June 2003 - 08:29 AM

some source code form another thread removed for space and relevance.

*cough cough* :nono:


edit by StankDawg: hated to do it, but please try to keep topics organized within their respectiv ethreads unless you can tie it into another thread.

#10 White_Raven

White_Raven

    That's so raven!

  • Banned
  • 1,597 posts

Posted 06 June 2003 - 12:16 PM

Fluxx, Thats off-topic and has noting to do with the thread... The only thing remotly having to so with the current thread is that code was done for educational reasons only.. Its clear you have a problem with it however so why dont you pm me and we can talk aboutit.

Stankdawg, Any mod, please edit that.. it has nothing to do with the topic at hand.

#11 StankDawg

StankDawg

    same old Dawg, no new tricks

  • Moderating Team
  • 8,073 posts
  • Country:
  • Gender:Male

Posted 06 June 2003 - 12:39 PM

hmmm... well, it does deal with the topic at hand since it demonstrates the differences in the two operands in question...

I don't like to edit a lot, because I beleive in free speech. However, I will edit it for the sake of maintenance of the boards.




BinRev is hosted by the great people at Lunarpages!