- 1
Error in output
Hello everyoneâșïž Iâm new here and I tried to play around print. I tried outputting print(2*3/4^6) and it didnât work. But before this I printed 2*3 and 6 was displayed. Looking forward for your help
2 Answers
+ 1
Sally Aba
print (2*3/4^6)
2*3 calculated to integer 6
2*3/4 calculated to float 1.5
2*3/4^6 raises exception since it calculated as 1.5^6 where 1.5 is float variable and 6 is integer
operator ^ expects two integer as operands for exclusive or operation in this print statement it is float and integer so it raises exception.
It can be used as bellow
print(2*3//4^6)
It prints evaluated value as 7
2*3//4 calculated as 1
1^6 calculated as 7
binary representation are
1 -> 0001
6 -> 0110
1^6 -> 0111
Answer is 7
DHANANJAY PATEL
0
Alright thank you very much