6. Who'er the users?


#1



https://www.codecademy.com/en/courses/ruby-beginner-en-X5wcR/0/6?curriculum_id=5059f8619189a5000201fbcb


Why do I get "Edgar"=>668 when I entered 01234?


my_computer = Computer.new("Edgar", 01234)
your_computer = Computer.new("Michael", 56789)

my_computer.create("films.txt")
your_computer.create("cars.txt")

puts "Users: #{Computer.get_users}"


#2

Here's a hint:

irb(main):001:0> 100
=> 100
irb(main):002:0> 0100
=> 64
irb(main):003:0> 0b100
=> 4
irb(main):004:0> 0x100
=> 256

#3

Oh dear, must read up about that. Have not met it before :open_mouth:


#4

Our culture represents numbers with 10 symbols. That is arbitrary. Computers use two. You were writing a number in octal. Hexadecimal is often used to represent bytes. base64 is sometimes used to store data as printable text much more densely than if using only digits, but still not utilising the full range of a byte which is how much space a character usually takes.


#5

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