SCT Error : 5. Getting more creative


#1



Exercise link

Hi everyone,

I've checked my code several times and visited the forums but haven't found a solution to my problem. I keep getting an SCT Error with the following code. Can anyone help ? Thanks.


class Computer
  @@users = {}
  
  def initialize(username,password)
  	@username = username
    @password = password
    @files = {}
    @@user[username] = password
  end
  
  def create(filename)
  	time = Time.now
    @files[filename] = time
    puts "#{filename} was created by #{@username} at 
#{time}."
  end
   
end


#2

My code is the same, the exact same as yours, minus the puts statement and I am getting the same thing. I have tried searching the forums as well, and no luck. I too, get an SCT error and for the life of me I cannot figure out why. I have also refreshed the page and reset the code, with no luck at that also.


#3

It seems there's a bug with the code checker. I copy-pasted the code from Section 1 and it still gives me an SCT error. I sent a bug report to Codecademy, but it'd be great if a dev could get back to us on this.


#4

@dfc3021 I reset the exercise and started from scratch and it worked ! My code changed as well, so I'm not sure why it's working now. Here's my code, just in case:

class Computer
  @@users = {}
  def initialize(username, password)
    @username = username
    @password = password
    @files = {}
    @@users[username] = password
  end
  def create(filename)
    time = Time.now
    @files[filename] = time
    puts "#{@username} has created #{filename} at #{time}!"
  end
end

#5

crazy dude! I tried it again and it wouldnt pass so I copied your code and it did, funny thing is, here is my code compared to yours and I cant figure out whats different lol

class Computer
  @@users = {}
  def initialize(username, password)
    @username = username
    @password = password
    @files = {}
    @@users[username] = password
  end
  def create(filename)
    time = Time.now
    @files[filename] = time
    puts "#{@filename} has been created at #{time} by #{username}."
  end
end

haha but thank-you though i passed now! appreciate your help


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.