Silent_Blade
Member-
Posts
17 -
Joined
-
Last visited
Awards
This user doesn't have any awards
Silent_Blade's Achievements
-
Thank you so much for your help, and to get such great help i am truly thankful and i will make sure to use all of your formatting tips, especially the one on the long lines of code and the \ one the reason i said to have values above 1 is because if the number is negative then it just breaks everything, but now i realize it just has to be above 0 in order to stay positive. I will also be sure to check out all of those python website. and i just ran the code and it works fine Once again thanks for all your help
-
print('Before you begin i would like to expalin what this program is meant to do') print (' ') print('The program will first ask you to enter a positve whole number, once you"ve done that the program will then rais 2 to that number, you will do this twice meaning in the end you wil have something like this: (2^x) and (2^y).') print (' ') print('then the program will take these numbers and sum them, so you will get the sum of (2^x) and (2^y).') print (' ') print('and lastly the program will give you the sum of all the values to the powers of 2 between your given values.') print (' ') print('example:') print (' ') print('2^4 and 2^8 ----------> (2^4) + (2^5) + (2^6) + (2^7) + (2^8).') print (' ') print ('Please enter a whole interger that you would like to be "x" in ----> (2^x), also make sure that your "x" value is greater than 1.') value1=int(input('value1: ')) print ('2^',int(value1)) print ('=') print (2**int(value1)) print ('Thank you, now enter your second value = y -----> (2^y).') value2=int(input('value2:')) print ('2^',int(value2)) print ('=') print (2**int(value2)) value3=(2**int(value1)) value4=(2**int(value2)) print (' ') print('The Sum of 2^',int(value1)) print('and 2^',int(value2)) print('is') print (value3 + value4) print (' ') print('and now the sum of all values from 2^',int(value1)) print('to 2^',int(value2)) print('is') x = 0 # a, b are the exponent values on 2 (i.e., 2**a and 2**b are your bounds) for i in range((int(value1)), ((int(value2))+1)): x += 2**i print(x) print (sum(range(int(value1)), ((int(value2))+1))) print (' ') print('Press enter to continue') print (' ') input(' ')
-
i tried the equation before but it wouldn't work for me so i tried using your method and it worked fine maybe i did something wrong before anyway, I've figured out a way to get the sum of something like this 2^4 to 2^8 ----------> (2^4) + (2^5) + (2^6) + (2^7) + (2^8) thanks to your help earlier But ive tried to also do this 2^4 -------> 2^7 2^4= 16 2^7=128 16+17+18+20+21............+125+126+127+128 i have coded for this and it seems to work, if u could just have a look over the whole thing and just give some pointers and feedback would be greatly appreciated Thank you here is the code: print('Before you begin i would like to expalin what this program is meant to do') print (' ') print('The program will first ask you to enter a positve whole number, once you"ve done that the program will then rais 2 to that number, you will do this twice meaning in the end you wil have something like this: (2^x) and (2^y).') print (' ') print('then the program will take these numbers and sum them, so you will get the sum of (2^x) and (2^y).') print (' ') print('and lastly the program will give you the sum of all the values to the powers of 2 between your given values.') print (' ') print('example:') print (' ') print('2^4 and 2^8 ----------> (2^4) + (2^5) + (2^6) + (2^7) + (2^8).') print (' ') print ('Please enter a whole interger that you would like to be "x" in ----> (2^x), also make sure that your "x" value is greater than 1.') value1=int(input('value1: ')) print ('2^',int(value1)) print ('=') print (2**int(value1)) print ('Thank you, now enter your second value = y -----> (2^y).') value2=int(input('value2:')) print ('2^',int(value2)) print ('=') print (2**int(value2)) value3=(2**int(value1)) value4=(2**int(value2)) print (' ') print('The Sum of 2^',int(value1)) print('and 2^',int(value2)) print('is') print (value3 + value4) print (' ') print('and now the sum of all values from 2^',int(value1)) print('to 2^',int(value2)) print('is') x = 0 for i in range((int(value1)), ((int(value2))+1)): x += 2**i print(x) print (sum(range(int(value1)), ((int(value2))+1))) print (' ') print('Press enter to continue') print (' ') input(' ')
-
Yes i had already defined a and b earlier, so i just put that in, in place of a and b. Im actually using python 3.5, and what if i wanted to sum all the values between 2 powers of 2 soo like: 2^4 -------> 2^7 2^4= 16 2^7=128 16+17+18+20+21............+125+126+127+128 because this is what i was trying to do earlier i can post the code i have so far if you would like to see it another question i had was what if i wanted the powers to be negative, would i have to change anything in the code.
-
Thank you all for your responses and feedback, The program is actually meant to give the sum of all values that are between 2 values that have a base of 2 example: 2^4 to 2^8 ----------> (2^4) + (2^5) + (2^6) + (2^7) + (2^8)
-
Ok, so i just started to learn how to write in python and i wanted to make a program that would give me the sum off all the values in a range, what i mean is i wanna be able to put in 2 number and want to find the sum of all the number between those 2 numbers Thank you
-
Thanks for the replies, but idk its working fine now it only acts weird at night like past 8
-
So i just built a new PC I5-4460 Asus H81M-E Plus motherboard Hyper X Fury GTX 960 Evga 500w bronze power supply Aright so my problem is that the pc would just randomly turn off at the windows screen when i would be putting in my password, so i restarted it a bunch of times and same problem, then i unplugged it and started it again after that it brought me to the American Megatrends screen ad got suck there for a while and on the very bottom of that screen it read "Power supply surges detected during previous power on. ASUS Anti-Surge was triggered to protect system from unstable power supply unit" So does that mean its a bad power supply and needs to be replaced, this is a brand new PC just built like a month ago. Any suggestions Thank you
-
Alright so ive changed the updates and last time it turned off the keyboard wasn't acting up, but i still was not able to type anything. When it turns off it does not complete shut down, because when i turn it back on it turns on almost immediately and i know my HDD is not that fast lol/ Still not sure what to do
-
Alright so this happened right after i installed windows and i was just browsing the web prior to this happening and i dont know weather it happens in safe mode or not and how can i see if windows update is secluded for 9PM i have malwarebytes and i am running it
-
HI, So i just built a new PC and im having a problem where the computer could be on all day if it has to be but just around 9 at night it turns itself off and then when i try to turn it back on it brings me to the screen where i enter my password, and the computer will just be typing randomly in the password area and when i try to delete what it types it wont let me it will just keep typing btw my motherboard drivers arnt installed should i install those as well. PLEASE HELP
-
Thanks for the reply everyone
-
Hi thanks for the replies and i was wonder if i were to get a network adapter what are some that you would recommend
-
Hi I just finished build my first PC and i was wondering if i should be wired in or get wireless internet, i would prefer wireless because it is difficult for me to run a Ethernet cable to my work space. Anyways i wanted to know if i want to have it wireless what network card or like adapter should i get, sorry im not too sure what exactly its called.