3 Replies - 236 Views - Last Post: 21 February 2013 - 03:47 PM Rate Topic: -----

#1 akumaukpo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-February 13

Find error within this code to help answer the question

Posted 21 February 2013 - 03:28 PM

 num_times = + 4 1
off$et = 1024
tmp = offset / 2
tmp / temp = 2
2 = tmp2
tmp = tmp / tmp2
tmp2 = 640000
tmp2 = tmp2/10,000
0ffset = tmp/tmp2
print('Bluh ' * int(num_times - offset)); 


I am a complete newbie to programming and this is a problem i need to practice for a quiz soon. I will need an explanation to guide me into solving the problem. All help is greatly appreciated. I have tried changing the first line from "+ 4 1" to "+ 2 1" and i have also tried changing the offset to 3.

This is the question/direction:

Without doing
any of the following:
 removing or adding any lines of code to the file
 altering the last line (the one with the print statement)
 changing any of the other lines to print statements
fix all the errors so that the string ’Bluh Bluh Bluh’ is what’s printed when you run the
file.


Is This A Good Question/Topic? 0
  • +

Replies To: Find error within this code to help answer the question

#2 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3608
  • View blog
  • Posts: 12,399
  • Joined: 12-December 12

Re: Find error within this code to help answer the question

Posted 21 February 2013 - 03:36 PM

What book or tutorial are you studying?
Was This Post Helpful? 0
  • +
  • -

#3 akumaukpo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-February 13

Re: Find error within this code to help answer the question

Posted 21 February 2013 - 03:40 PM

View Postandrewsw, on 21 February 2013 - 03:36 PM, said:

What book or tutorial are you studying?


"Starting Out with Python second edition"
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3608
  • View blog
  • Posts: 12,399
  • Joined: 12-December 12

Re: Find error within this code to help answer the question

Posted 21 February 2013 - 03:47 PM

My question was rhetorical. If you study beyond the first two or three chapters it should cover arithmetic expressions, or search for this topic in the table or contents or index. All I can interpret from your post is that you have made a couple of random guesses: I don't know why you would think '+ 2 1' would work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1