Dec-14-2018, 11:25 AM
What output will the following code give?
>>> word=’abcdefghij’
>>> word[:3]+word[3:]
What will the following code output?
|
Dec-14-2018, 11:25 AM
What output will the following code give?
>>> word=’abcdefghij’ >>> word[:3]+word[3:]
Dec-14-2018, 11:28 AM
What do you think? Did you try to run it if not able to say just from looking at it?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Dec-14-2018, 11:34 AM
(This post was last modified: Dec-14-2018, 11:35 AM by Gribouillis.)
It would have been faster and more efficient to type the same code in the python interpreter instead of the forum!
Dec-14-2018, 02:00 PM
The output is:
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures
Dec-14-2018, 02:05 PM
If you are on linux, just enter on your keyboard :
python3 If you are on windows, download the last release on : https://www.python.org/downloads/windows/ If you cannot install because you don' have administrative access... try to find some web site with a python terminal for free. You can also buy a raspberrypi (arround 10$), but you will need also a screen and a keyboard (take them from the pc you used for the forum), and you will have to download and install raspbian. If you fail with all of that, read the doc : https://docs.python.org/3/tutorial/index.html , your brain will give you the answer quickly.
Dec-15-2018, 06:05 AM
The output is ‘abcdefghij’. The first slice gives us ‘abc’, the next gives us ‘defghij’.
|
|