2021-01-18 17:13:33 +0200 | asked a question | Please tell me how to write a loop Hello there please tell me how to set that arr[i] within the for loop, that is going outside of the loop If array value at a index is 1 I have set it to the power of 2 IDK about this I'm trying for so long. Please help me with this. Thanks again |
2021-01-18 16:19:48 +0200 | commented question | I should store binary values in an array Thanks please if you understand the question please answer it. |
2021-01-18 15:56:32 +0200 | commented question | How to use for loops and assign values to array Now please check again I have written the program. Also how to initiate elements in array, please tell me |
2021-01-18 13:47:01 +0200 | received badge | ● Editor (source) |
2021-01-18 13:45:54 +0200 | commented question | How to use for loops and assign values to array Thanks for the response x=3 z=IncreasingArrays() z=x.binary() for i in range(x): if(z[i]==1): print (' ',2^i) #Not printing here I want to print if binary value is 1 And raise it to power 2 For loop isn't printing print statement also Please help me with these for loops and also how to store values in an array in C I go int a[6]; for(i=2;i<=5;i++) { a[i]=1; } Here like this in C, array values are set. How to do the same in sage please help |
2021-01-18 11:53:34 +0200 | received badge | ● Student (source) |
2021-01-18 11:47:39 +0200 | asked a question | How to use for loops and assign values to array
I'm unable to print the 3rd line it always says space indent etc. How to solve this? Also please help me how to assign values in an array in for loop Also binary values I should store in array how to?? I'm new please help I'm using this only on sagemath cell server online Thanks |
2021-01-18 11:47:39 +0200 | asked a question | I should store binary values in an array Given a Sage integer, I wish to obtain the list of its binary digits. How can I get that? So far, I found the Given an integer, that method returns its binary expansion as a string. For example: Thanks for the response. Here is a follow-up question. I want to print if binary value is 1. And raise it to power 2. The In C I go: Here like this in C, array values are set. How to do the same in Sage please help. |