#๐ help
1484 messages ยท Page 2 of 2 (latest)
whats cs
oof....
cursor?
oh
anyway
Computer Sceince
yeah its my first ever college class of cs
ik how to use windows and game but not coding
use this for now
this is probably the way that your teacher wants, just if x == "a" or x == "A" should be fine (for now)
do you want to move to the third question?
to my knowledge context is they in first week of python if not newer
so im not surprised at all at them not knowing functions
its my fourth day
ur : are messed up but u getting the spirit
trying to get the least red possible on my screen
you want to add the salutation = "madame" for each of these conditions
oh yeah
idk where to place them
i know where theres 1 condition but not 2 on one line
what do you mean?
you can delete the code above, the ones that use in
you will get your chance to make use of in in the future
comment those out by selecting all the code there and pressing Ctrl + / on your keyboard
yup
my teacher told us abt that too
really useful
can we do the binary one pls
it is probably a good habit to add a new line
ive been awake since too long
yeah
go on
im confused when to put a semi colon on the else
i forgot that time but i always make a new line
you dont use semi colons in python
colon*
what's the third question
@strange turret
i meant that
my brain is dying rn but ik u use colong lol
mb
"user's right" ๐ญ
this one makes more sence
ye mb
or "rights"
user's right are typed on a 4 bye binary number every right is encoded in binary they gtive acess to a specific module
1-RH
2-inventory
4-compatibility
8-computer science
Tests:
with 0b1011:
acess to RH moduel
acess to inventory moduleacess to computer science module
with 0b0000:
acess to none of hte module
with 0b0100
acess to compatibility module
this is a wild question to give a beginner
perfect
id have to pull my notes but i get teh gist
so what do i start with
i have NO clue
what is the method your teacher taught for converting bases
hmmmm
i forgot but uh
if i remember you use modulo
or smt
ik you use modulo to do divmod
can you write out a program to convert a number from base 16 to base 2
how your teacher teach it
uh
id have to pull my notes out
but
ik that it works with the power of 2
1000 = 8
for example
ik hexadecimal
a bit
show some basic program that will convert it
also kindly put words on single message
alright
not doing this to annoy anyone lol its out of habit i just type how i tell sentence
test = 0b1000
print(test) # 8
is this the method your teacher taught?
hmmm
thats a literal value.... thats not converting anything
you get what i meant
remember, beginner python
from part of the question
with 0b0100 -> access to compatibility module
do you know what this means?
no
probably a value thats equal to accessing the compatibility module
i think b = 11
in hex
essentially you can think of it like this
0b1000 -> lets you access the computer science module
0b0100 -> compatibility
0b0010 -> inventory
0b0001 -> RH
so far so good?
correct
if you type it on python it would automatically convert into decimal
thats what the question is giving you as a problem
i didnt know there was a question
this is the problem statement
/genuinely
is this not the third question?
only rh???
0b1000 -> lets you access the computer science module
0b0100 -> compatibility
0b0010 -> inventory
0b0001 -> RH
for reference
correct
oh so
the 1 at different positions refers to access to different modules
0b1011
the first 1 starting from left to right is rh
2nd is inventory
3rd is cs
4th is compatibility
yup
actually wait
0b0001 = 1 in decimal -> RH
0b0010 = 2 in decimal -> inventory
it's right to left
given a number 0bXXXX, calculate which modules you have access to
sending my whole file incase i lose it
Click here to see this code in our pastebin.
what is the number they give
we didnt read the same text lmao
do i just type out every single combination?
no
you just save it in a variable
access_code = 0b1011
or something like that
ok so now
i just dont understand the goal im working toward
given any access_code
which could be something like 0b1011
calculate the modules you have access to
idk whats the acess code
print out the modules you have access to
the access code is variable
it's the thing the user feeds into your program
we dont know what the access code is
we are suppose to write a program that takes any access code and process it into the modules
makes sense?
0b1001 = RH
0b1010 = Inventaire
0b1011 = Informatique
0b1111 = compatibite
follow my train of thought
ohhh
yes
sorry
ok now i want you to notice one thing
0b1000 = 8 in decimal = has access to Informatique
0b1001 = 9 in decimal = has access to Informatique and RH
0b1010 = 10 in decimal = has access to Informatique and Inventaire
0b1011 = 11 in decimal = has access to Informatique and RH and Inventaire
yeah?
these are all >= 8 in decimal right?
yes
0b0000 = 0 in decimal = has access to
0b0001 = 1 in decimal = has access to RH
0b0010 = 2 in decimal = has access to Inventaire
0b0011 = 3 in decimal = has access to RH and Inventaire
these are all < 8 in decimal
notice that you no longer have access to informatique
yup
correct?
yeah
so we can form an idea right now, >=8 has access to informatique, < 8 has no access
we dont know whether it is correct for all modules
we just know that it is correct for informatique
wait but both of ? 8 and < 8 has acess to rn and inventaire
but thats not what we care about right?
true
the difference that we are can spot is the informatique is controlled strictly by >= 8 or < 8
so informatique = 8?
alright
so let's try it with another module
0b0001 = 1 in decimal = has access to RH
0b0011 = 3 in decimal = has access to Inventaire and RH
0b0111 = 7 in decimal = has access to Comp, Inventaire and RH
all of these have access to RH
oh so as long as there's a 1 in the decimal we have acess to rh?
0b0000 = 0 in decimal = has access to nothing
0b0010 = 2 in decimal = has access to Inventaire
0b0110 = 6 in decimal = has access to Comp, Inventaire
1, 3, 7 vs 0, 2, 6
oh man this is hard
odd number
do you know what is 1 % 2?
how about 2 % 2
0?
3 % what
3 % 2
4?
4 % 2 = 0
notice something?
so we now know
there is a number that we can % with
in order to check if a number if even or not
that number is of course, 2
if 0b1001, which is 9, 9 % 2 = 1 so we have access to RH
ohhhh
of course we cant use % 2
odd and even?
we need to find another number
idk if its called even number
8why
yes
informatique is 8
yes
thers simpler way, its called masking where you reject all bits and get some part of it
meu
i learnt like 2 days ago that binary number worked with power of 2
and how to count is hexadecimal
masking is way easier than power of 2
i dont know what masking is
look at this
oh my god thats so cool
wait...
if only i could understand whats going on
so how do i even solve it
print(0b0010 % 4) # 2
print(0b0011 % 4) # 3
print(0b0110 % 4) # 2
print(0b1110 % 4) # 2
these all have access to Inventaire
ohhh
print(0b0000 % 4) # 0
print(0b0001 % 4) # 1
print(0b0100 % 4) # 0
print(0b1100 % 4) # 0
these all do not
notice a pattern?
the second one has 1 as a decimal
print(0b0110 % 8) # 6
print(0b0111 % 8) # 7
print(0b0110 % 8) # 6
print(0b1110 % 8) # 6
these all have access to comptabilite
compatibility is 4
print(0b0000 % 8) # 0
print(0b0001 % 8) # 1
print(0b0011 % 8) # 3
print(0b1011 % 8) # 3
and these dont
do you notice a pattern?
what in the silly binaries we doing, why is there % here
my brain is beyond fried
i cant understand whats going on but at the same time i do a bit
modulus ๐
haha thats why we are looking at patterns
the patterns let you spot things
so you dont have to rely on pure maths
do you atleast know what modulus is?
yes
what is modulus?
holy flip
hold on let me think of how to explain
the rest of a division like u did in 4th graade
i just wanna make sure you know the stuff you working on
i know whats modulus but i cant explain it
yk the divisino you did when u were younger
its the rest of it that is the answer to the modulus
4%5 = 1
print(0b0110 % 8 // 4) # 1
print(0b0111 % 8 // 4) # 1
print(0b0110 % 8 // 4) # 1
print(0b1110 % 8 // 4) # 1
print(0b0000 % 8 // 4) # 0
print(0b0001 % 8 // 4) # 0
print(0b0011 % 8 // 4) # 0
print(0b1011 % 8 // 4) # 0
can you see the pattern now?
i hope this person know the order of operetion...
they both have acess
i do
access to what?
informatique and comptability
print(0b0110 % 8 // 4) # 1
print(0b0111 % 8 // 4) # 1
print(0b0110 % 8 // 4) # 1
print(0b1110 % 8 // 4) # 1
# ^ look at this bit
print(0b0000 % 8 // 4) # 0
print(0b0001 % 8 // 4) # 0
print(0b0011 % 8 // 4) # 0
print(0b1011 % 8 // 4) # 0
# ^ look at this bit
is this clearer now?
thats just masking with extra step.....
but hey, letting people discover stuff on their own is fun
print(0b0001 % ? // ?)
# ^ RH
print(0b0010 % ? // ?)
# ^ Inventaire
print(0b0100 % 8 // 4) # <- this was the one i gave you the answer to earlier
# ^ Comptabilitie
print(0b1000 % ? // ?)
# ^ Informatique
fill up the question marks
so that all 4 lines print 1
yes
1 % 2 // 1 = 1
1//1 = 1 yes
whatw as i supposed to put
you are suppose to spot the pattern and fill in the question marks
sorry im trying my best
the question marks in this
if you read the message of zehata youll find the patern
trust me im reading it
copy the message she sent and fill the ?
print(0b0110 % 8 // 4) # 1
print(0b0111 % 8 // 4) # 1
print(0b0110 % 8 // 4) # 1
print(0b1110 % 8 // 4) # 1
# ^ look at this bit
print(0b0000 % 8 // 4) # 0
print(0b0001 % 8 // 4) # 0
print(0b0011 % 8 // 4) # 0
print(0b1011 % 8 // 4) # 0
# ^ look at this bit
print(0b0001 % ? // ?)
# ^ RH = 1
print(0b0010 % ? // ?)
# ^ Inventaire = 2
print(0b0100 % 8 // 4) # <- you already have the answer to this one
# ^ Comptabilitie = 4
print(0b1000 % ? // ?)
# ^ Informatique = 8
print(0b0001 % 2 // 1)
# ^ RH
print(0b0010 % 4 // 2)
# ^ Inventaire
print(0b0100 % 8 // 4) # <- this was the one i gave you the answer to earlier
# ^ Comptabilitie
print(0b1000 % 16 // 8)
# ^ Informatique
well
I GOT IT
wait wait wait
!e
print(0b0001 % 2 // 1)
# ^ RH
print(0b0010 % 4 // 2)
# ^ Inventaire
print(0b0100 % 8 // 4) # <- this was the one i gave you the answer to earlier
# ^ Comptabilitie
print(0b1000 % 16 // 8)
# ^ Informatique
:white_check_mark: Your 3.13 eval job has completed with return code 0.
001 | 1
002 | 1
003 | 1
004 | 1
dont go that far yet
nice
very well
oh right
the access code we dont know
that's the whole point of the program
it takes some access code that the user types in
hmmmm
i just dont get why we doing all the modulo stuff to find numbers
i know how to but not why
that's just what the question is asking you to do
this is just a learning exercise
i just dont understood how you went from random bytes to translating codes to answering the question
but i understood what the numbers meant at one poitn
the question is asking you to write a program right?
the user enters an access_code of their own choice
that we don't know
ohh
use this fact you already figured out to write out some conditions
print(0b0001 % 2 // 1) # 1 -> has access
print(0b0000 % 2 // 1) # 0 -> no access
# ^ this bit controls RH access
print(0b0010 % 4 // 2) # 1
# ^ Inventaire
print(0b0100 % 8 // 4) # 1
# ^ Comptabilitie
print(0b1000 % 16 // 8) # 1
# ^ Informatique
this was what you figured out
EDIT: see my comments in the code
you got the spirit
wait
if access_code % 2 // 1 = 1, then we have access to RH
remember, we dont know what the user entered
oh
we are probing what it is with our % 2 // 1
and we are checking the result =1
to determine if we have access
do i do it with every other digit
yup. basically
theres like 8
4
?
there are only 4 modules
why not 8 cauz 8 possibilities
but you can use else
OH.
you have 4 modules dammit xD
im sorry ๐ญ
how do you check 4 modules with 2 if elses
you need 1 if else for each module right?
why?
no. i am describing how many if else block you need
uh
if code_acess % 2 // 1 == 1:
print("has access to RH")
else:
print("has no access to RH")
thats literally what i did lol
this is RH
you should know how to write the other 3 right?
for yes
nice
could you resume what we did
anyway
cauz im going to note this
i actually gtg
haha cya go to sleep now
Yeah Iโd love you re explain it to me rq I get the base idea but not everything
If you have time tomorrow you already helped me so much
I understand the bits but what I wouldโve done alone I wouldโve tried out every single combinaison and did 15 if lol
Iโd like to understand your method later IF you have time and IF you want
I canโt say how much Iโm thanking u lol gn
What help do you need?
I didnโt understand the whole problem but Iโll get back to it tmr
Starting here
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.