#๐Ÿ”’ help

1484 messages ยท Page 2 of 2 (latest)

strange turret
#

yea

violet vortex
#

whats cs

stone ice
#

oof....

violet vortex
#

cursor?

strange turret
#

yea context matters

#

cs is computer science

violet vortex
#

oh

strange turret
#

anyway

stone ice
#

Computer Sceince

violet vortex
#

yeah its my first ever college class of cs

#

ik how to use windows and game but not coding

strange turret
#

use this for now

violet vortex
#

ill put it in the comments

#

i can do both easily (now)

#

now

strange turret
#

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?

jovial sail
#

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

jovial sail
violet vortex
#

trying to get the least red possible on my screen

strange turret
#

you want to add the salutation = "madame" for each of these conditions

violet vortex
#

yup

#

:DDDD

#

i finally did it

#

and i understood what i did

strange turret
#

you forgot the colons

#

:

violet vortex
#

oh yeah

#

idk where to place them

#

i know where theres 1 condition but not 2 on one line

strange turret
#

what do you mean?

stone ice
#

the color was on the end of the line with "if"

#

colon*

strange turret
violet vortex
strange turret
#

you can delete the code above, the ones that use in

#

you will get your chance to make use of in in the future

violet vortex
#

yeah

#

but i still wanna leave it there as notes

strange turret
violet vortex
#

yup

#

my teacher told us abt that too

#

really useful

#

can we do the binary one pls

strange turret
#

it is probably a good habit to add a new line

violet vortex
#

ive been awake since too long

violet vortex
strange turret
violet vortex
#

im confused when to put a semi colon on the else

#

i forgot that time but i always make a new line

strange turret
strange turret
#

what's the third question

violet vortex
#

@strange turret

violet vortex
#

my brain is dying rn but ik u use colong lol

#

mb

stone ice
#

"user's right" ๐Ÿ˜ญ

violet vortex
#

ey

#

thats how its literally translated

#

user's previlege

#

?

stone ice
violet vortex
#

ye mb

stone ice
#

or "rights"

strange turret
#

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

violet vortex
#

i knew how to translate from base 16 to base 2

#

if that can help

strange turret
violet vortex
#

id have to pull my notes but i get teh gist

#

so what do i start with

#

i have NO clue

strange turret
#

what is the method your teacher taught for converting bases

violet vortex
#

hmmmm

#

i forgot but uh

#

if i remember you use modulo

#

or smt

#

ik you use modulo to do divmod

strange turret
#

wow

#

that is wild, i thought they will go the easier method

#

but anyway

violet vortex
#

5 % 4 = 5

#

4 % 5 = 1

strange turret
#

can you write out a program to convert a number from base 16 to base 2

violet vortex
#

no

#

uh

#

yeah i have NO clue

stone ice
#

how your teacher teach it

violet vortex
#

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

stone ice
#

show some basic program that will convert it

violet vortex
#

i would have to look at my notes

#

i dont know how

stone ice
#

also kindly put words on single message

violet vortex
#

alright

#

not doing this to annoy anyone lol its out of habit i just type how i tell sentence

strange turret
#
test = 0b1000
print(test) # 8

is this the method your teacher taught?

violet vortex
#

yeah he showed that

#

not how to convert or anything

strange turret
#

hmmm

stone ice
strange turret
#

remember, beginner python

#

from part of the question
with 0b0100 -> access to compatibility module

#

do you know what this means?

violet vortex
#

no

#

probably a value thats equal to accessing the compatibility module

#

i think b = 11

#

in hex

strange turret
#

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?

violet vortex
#

yes

#

so i gotta translate those hex number into real values?

strange turret
#
0b0010 -> inventory
0b0001 -> RH
0b0011 -> inventory + RH
#

makes sense?

violet vortex
#

oh you added them up

#

why tho

strange turret
#

correct

stone ice
strange turret
violet vortex
#

i didnt know there was a question

strange turret
#

this is the problem statement

violet vortex
#

/genuinely

strange turret
#

is this not the third question?

violet vortex
#

it si

#

it is

#

even in french there wasnt a question just statements

strange turret
#

0b1001 what would this give access to?

#

just as a small test

violet vortex
#

only rh???

strange turret
#

look closely

#

it's 1001

violet vortex
#

yeah

#

uhhh

#

oh wait

#

a byte = to an acess

strange turret
#
0b1000 -> lets you access the computer science module
0b0100 -> compatibility
0b0010 -> inventory
0b0001 -> RH

for reference

violet vortex
#

thanks

#

alr so

#

cs module and rh

strange turret
#

correct

violet vortex
#

how did u know 0b0001 was rh

#

only

strange turret
#

you sent

violet vortex
#

oh so

strange turret
#

the 1 at different positions refers to access to different modules

violet vortex
#

0b1011
the first 1 starting from left to right is rh
2nd is inventory
3rd is cs
4th is compatibility

strange turret
#

yup

violet vortex
#

IM STUPID.

strange turret
#

actually wait

#
0b0001 = 1 in decimal -> RH
0b0010 = 2 in decimal -> inventory
#

it's right to left

violet vortex
#

okay

#

so whats even the question

#

how do get every right?

strange turret
#

given a number 0bXXXX, calculate which modules you have access to

violet vortex
thick martenBOT
violet vortex
#

we didnt read the same text lmao

#

do i just type out every single combination?

strange turret
#

no

#

you just save it in a variable

#

access_code = 0b1011

#

or something like that

#

ok so now

violet vortex
#

i just dont understand the goal im working toward

strange turret
#

given any access_code

#

which could be something like 0b1011

#

calculate the modules you have access to

violet vortex
#

idk whats the acess code

strange turret
#

print out the modules you have access to

strange turret
#

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?

violet vortex
#
0b1001 = RH
0b1010 = Inventaire
0b1011 = Informatique
0b1111 = compatibite
strange turret
#

follow my train of thought

strange turret
#

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
violet vortex
#

yeah?

strange turret
#

these are all >= 8 in decimal right?

violet vortex
#

yes

strange turret
#
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

violet vortex
#

yup

strange turret
#

correct?

violet vortex
#

yeah

strange turret
#

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

violet vortex
#

wait but both of ? 8 and < 8 has acess to rn and inventaire

strange turret
#

but thats not what we care about right?

violet vortex
#

true

strange turret
#

the difference that we are can spot is the informatique is controlled strictly by >= 8 or < 8

violet vortex
#

so informatique = 8?

strange turret
#

we dont know yet

#

for the other modules

#

it might not be true

violet vortex
#

alright

strange turret
#

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

violet vortex
#

oh so as long as there's a 1 in the decimal we have acess to rh?

strange turret
#
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

violet vortex
#

oh man this is hard

strange turret
#

is it clearer now?

#

what does 1, 3, 7 have in common

#

but 0, 2, 6 dont

violet vortex
#

odd number

strange turret
#

correct

#

how do you know if a number is odd or even

#

in code

violet vortex
#

uh

#

odd = 1
odd = 3
odd = 7

#

(im joking they always end with 1 in binary code)

strange turret
#

do you know what is 1 % 2?

violet vortex
#

1

#

thats why its odd in binary

strange turret
#

how about 2 % 2

violet vortex
#

0?

strange turret
#

yup, 0

#

how about 3

violet vortex
#

3 % what

strange turret
#

3 % 2

violet vortex
#

1

#

oh

strange turret
#

4?

violet vortex
#

4 % 2 = 0

strange turret
#

notice something?

violet vortex
#

yes

#

i noticed it

#

we learnt that in math class

#

i think

strange turret
#

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

violet vortex
#

yeah

#

bcz binary

strange turret
#

the % 2 lets us check if we have access to RH

#

and RH corresponds to 1 = 0b0001

violet vortex
#

rh is 9 so its odd

#

oh you mean the ending digit

strange turret
#

if 0b1001, which is 9, 9 % 2 = 1 so we have access to RH

violet vortex
#

ohhhh

strange turret
#

and so

#

do you think we might be able to do the same for informatique?

violet vortex
#

yes

#

but it would be even

strange turret
#

of course we cant use % 2

violet vortex
#

odd and even?

strange turret
#

we need to find another number

violet vortex
#

idk if its called even number

violet vortex
strange turret
#

checking if %2 = 1 corresponds to RH

#

not informatique

violet vortex
#

ohh

#

is that how you know rh is 1

strange turret
#

yes

violet vortex
#

informatique is 8

strange turret
#

yes

violet vortex
#

cant u just use 4

#

or 2

stone ice
#

thers simpler way, its called masking where you reject all bits and get some part of it

violet vortex
#

meu

stone ice
#

like 0bxx00 where x will be rejected

#

its simpler

violet vortex
#

i learnt like 2 days ago that binary number worked with power of 2

#

and how to count is hexadecimal

stone ice
#

masking is way easier than power of 2

violet vortex
#

i dont know what masking is

stone ice
#

look at this

violet vortex
#

oh my god thats so cool

stone ice
#

wait...

violet vortex
#

if only i could understand whats going on

stone ice
#

wait what...

#

..... why....

violet vortex
#

so how do i even solve it

strange turret
#
print(0b0010 % 4) # 2
print(0b0011 % 4) # 3
print(0b0110 % 4) # 2
print(0b1110 % 4) # 2

these all have access to Inventaire

violet vortex
#

ohhh

strange turret
#
print(0b0000 % 4) # 0
print(0b0001 % 4) # 1
print(0b0100 % 4) # 0
print(0b1100 % 4) # 0

these all do not

#

notice a pattern?

violet vortex
#

the second one has 1 as a decimal

strange turret
#
print(0b0110 % 8) # 6
print(0b0111 % 8) # 7
print(0b0110 % 8) # 6
print(0b1110 % 8) # 6

these all have access to comptabilite

violet vortex
#

compatibility is 4

strange turret
#
print(0b0000 % 8) # 0
print(0b0001 % 8) # 1
print(0b0011 % 8) # 3
print(0b1011 % 8) # 3
#

and these dont

#

do you notice a pattern?

jovial sail
#

what in the silly binaries we doing, why is there % here

violet vortex
#

my brain is beyond fried

#

i cant understand whats going on but at the same time i do a bit

stone ice
#

modulus ๐Ÿ™„

strange turret
#

haha thats why we are looking at patterns

#

the patterns let you spot things

#

so you dont have to rely on pure maths

stone ice
#

do you atleast know what modulus is?

violet vortex
#

yes

stone ice
#

what is modulus?

violet vortex
#

holy flip

#

hold on let me think of how to explain

#

the rest of a division like u did in 4th graade

stone ice
#

i just wanna make sure you know the stuff you working on

violet vortex
#

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

strange turret
#
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?

stone ice
#

i hope this person know the order of operetion...

violet vortex
strange turret
violet vortex
#

informatique and comptability

strange turret
#

the first 4

#

what modules do they all have in common

violet vortex
#

inventory as wel?

#

even

#

oh

#

i see

strange turret
#
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?

violet vortex
#

ohhh ui u see

#

odd vs even

#

yes i see!

stone ice
#

thats just masking with extra step.....

strange turret
violet vortex
#

yes

#

ima learning

#

and not copying

strange turret
# violet vortex yes i see!
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

violet vortex
#

hm

#

alr

#

the first one is 1 bit 2 bit 4 bit 8 bit

#

in order but

#

1 % 2 = 1?

stone ice
#

yes

violet vortex
#

1 % 2 // 1 = 1

stone ice
#

1//1 = 1 yes

violet vortex
#

whatw as i supposed to put

strange turret
#

you are suppose to spot the pattern and fill in the question marks

violet vortex
#

sorry im trying my best

strange turret
violet vortex
#

line 5 = 2

#

?

stone ice
#

if you read the message of zehata youll find the patern

violet vortex
#

trust me im reading it

stone ice
#

copy the message she sent and fill the ?

strange turret
#
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
violet vortex
#

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

strange turret
#

well

violet vortex
#

I GOT IT

strange turret
#

do you want to check?

#

in your code?

#

do you know how to solve the question now?

stone ice
#

do this
!e
```py
code()
```

#

the python bot will run it for you

violet vortex
strange turret
violet vortex
#

!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

thick martenBOT
strange turret
#

dont go that far yet

stone ice
#

very well

strange turret
#

let's write out the conditions first

violet vortex
#

oh right

strange turret
#
if access_code % 2 // 1:
  print("???")
#

what should we print?

violet vortex
#

depend on the acess code

#

??

strange turret
#

the access code we dont know

#

that's the whole point of the program

#

it takes some access code that the user types in

violet vortex
#

1248?

#

is the acess code>

strange turret
#

hmmmm

violet vortex
#

i just dont get why we doing all the modulo stuff to find numbers

#

i know how to but not why

strange turret
#

this is just a learning exercise

violet vortex
#

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

strange turret
#

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

violet vortex
#

ohh

strange turret
#
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

violet vortex
#

uhhh

#

im not sure

#

if (0b0001 % 2 // 1) = 1:
print( has acess to RH)

#

??

strange turret
violet vortex
#

wait

strange turret
#

if access_code % 2 // 1 = 1, then we have access to RH

#

remember, we dont know what the user entered

violet vortex
#

oh

strange turret
#

we are probing what it is with our % 2 // 1

#

and we are checking the result =1

#

to determine if we have access

violet vortex
strange turret
#

comparison is ==

#

not =

violet vortex
#

do i do it with every other digit

strange turret
#

yup. basically

violet vortex
#

theres like 8

strange turret
#

4

violet vortex
#

?

strange turret
#

there are only 4 modules

violet vortex
#

why not 8 cauz 8 possibilities

strange turret
violet vortex
#

OH.

strange turret
#

1 if else for each module right?

#

so 4 if else

violet vortex
#

yes yes

#

i get it

#

wait not 2?

strange turret
#

you have 4 modules dammit xD

violet vortex
#

im sorry ๐Ÿ˜ญ

strange turret
#

how do you check 4 modules with 2 if elses

#

you need 1 if else for each module right?

violet vortex
#

%

#

% 2

strange turret
#

why?

violet vortex
#

bcz its going to be 0

#

?

#

im going to get burned to death lol

strange turret
#

no. i am describing how many if else block you need

violet vortex
#

2

#

bcz if its not 1 its 0

strange turret
#

the question is solved

#

you dont need any more math

#

why are you doing math?

violet vortex
#

uh

strange turret
#
if code_acess % 2 // 1 == 1:
  print("has access to RH")
else:
  print("has no access to RH")
violet vortex
#

thats literally what i did lol

strange turret
#

this is 1 if else

#

you need 4 of these

#

1 for each module

strange turret
#

you should know how to write the other 3 right?

violet vortex
#

for yes

strange turret
#

nice

violet vortex
#

could you resume what we did

strange turret
#

anyway

violet vortex
#

cauz im going to note this

strange turret
#

i actually gtg

violet vortex
#

that makes sense

#

its 3am

#

but if you have time tomorrow it owuld be really cool

strange turret
#

haha cya go to sleep now

violet vortex
#

thank you so muc hagain you have insane patience

#

thanks for helping me

#

gn!!

violet vortex
#

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

idle bobcat
#

What help do you need?

violet vortex
#

I didnโ€™t understand the whole problem but Iโ€™ll get back to it tmr

thick martenBOT
#
Python help channel closed for inactivity

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.