Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7031097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:45:28+00:00 2026-05-28T00:45:28+00:00

I apologize since this might be a common question, but I think I am

  • 0

I apologize since this might be a common question, but I think I am looking for a quite specific answer that wouldn’t be found in other topics. Basically, I am quite confused about the flow of adding numbers. Here are two similar codes that compute numbers differently. Is there any simple explanation for this?

>>> a = 0
>>> b = 1
>>> while b <1000:
    print b
        a, b = b, a+b


1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987

>>> a =0
>>> b=1
>>> while b<1000:
       print b
       a = b
       b = a+b


1,2,4,8,16,32,64,128,256,512
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:45:29+00:00Added an answer on May 28, 2026 at 12:45 am

    The difference lies in what the values are WHEN swapped

    a, b = b, a+b

    sets a to b and sets a to a+b but the swaps are done relatively at the same time so it’s not in order, ie the change in b doesn’t respect that a was changed first.

    In the second example

    a = b
    
    b = a+b
    

    the values are changed and the 2nd statement respects the change of the first

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize since this is rather a n00bish question, but I can't figure this
I apologize for the subjectiveness of this question, but I am a little stuck
I apologize if this is a duplicate post, but I couldn't find the answer
I apologize if this question has been asked before, but my case is a
I apologize up-front if this is a really obvious question since I'm pretty sure
First of all, I apologize for yet another interface question. I thought that this
I have a question, and I'm going to tag this subjective since that's what
(I apologize that previous versions of this question displayed the wrong function that I
I apologize in advance if this question seems confused. The behaviour I am seeing
I apologize before hand if this is an obvious question: can Apache 2.0 +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.