0
How do i fix this code. Im trying to pull an item from a list. Have that item mean a word, and pull it by using user input
abc=[1, 2, 3] abc.index([0]) = apple abc.index([1]) = bananna abc.index([2]) = cat if (int(input(''))) = 1 print abc.index(1) elif (int(input(''))) = 0 print abc.index(0)
11 Answers
+ 2
Index doesn't work as you think. This is an example of using it:
https://code.sololearn.com/cHsz7VWS9k2I
+ 3
I thought it meant as a # from an array to be pulled
+ 2
i am looking for the algorithme to revert binaires.
from 01111111 to 10000000
+ 1
I'm trying to make a thing for my science class and write. if user input h then it'll pull a variable from list and make it tell info about hydrogen. I think I can make this work tho. if I do your code but add 1 == he == helium and then put print (he) and then put in another list is he info and it'll print
helium
2 protons
2 electrons and ect. does that make sense or should I not try that and frusterate myself?
+ 1
Do you know classes as yet? They could store all of the information as a single entity in your list. You could search them with atomic number (integer), chemical name (3 or more letters), or chemical symbol (1 or 2 letters).
+ 1
not yet. still working towards my certificate. if you look at my python code I posted I did I lowerlvl version of that. not indexing and more focused on orbitals. I'm a highschool freshman and I want to get into this as a career so I thought I'd try to start early
+ 1
You definitely did not start early. My son started programming at 8. It was his plan to do college for it next year. But, decided to do automotive first followed by computers. He wants to fully computerize cars.
+ 1
wow. I meant like nearly any of my friends in school are doing anything to work for their career. I've recently started this and I want to go more on the informative/game developer side. I was just letting you know and thx for the help. I hope some day I can be as good as you or your son.
+ 1
also he's had you to guide him and this app is all I have for me.
+ 1
I am willing to help. Tag me in a code comment anytime you got a question.
+ 1
Christopher D. Museme if you just want to flop bits:
int bits = 0x84218421;
bits ^= 0xffffffff;
yields: 0x7bde7bde