#1
Posted 14 December 2013 - 11:24 PM
#2 Guest_ElatedOwl_*
Posted 15 December 2013 - 01:47 PM
Can you post your current code please?
#3
Posted 12 January 2014 - 03:48 PM
seriously you should at least know that you have to post your own code
#4 Guest_ElatedOwl_*
Posted 12 January 2014 - 04:51 PM
seriously you should at least know that you have to post your own code
No need to be rude about it. x:
#5
Posted 12 January 2014 - 05:43 PM
No need to be rude about it. x:
that's not rude unless you read it in a funny angry rude accent, try reading in a different way.
If this is the case you're the one full of negative energy not me.
#6
Posted 12 January 2014 - 05:46 PM
I don't use Python, but what I imagine they want you to do is have variables with all those names in a list and then just change this list so the variables are printed in a different order.
Guessing the class is over now though, hope you passed!
#7
Posted 29 April 2014 - 11:29 PM
What version of Python are you using?
#8
Posted 14 November 2016 - 04:26 PM
I don't use Python, but what I imagine they want you to do is have variables with all those names in a list and then just change this list so the variables are printed in a different order.
Guessing the class is over now though, hope you passed!
That is what you are supposed to do!
def complaint():
print('A baked cow on the Sun. The cow is baked again by the Sun. The Sun ejects the double-baked cow. The overcooked animal ends up on my plate.')
def main():
complaint()
main()
#9
Posted 29 December 2016 - 05:12 PM
I have to write a code doing this:create a list named "hobbit". Add the characters in the following order: "Bilbo", "Gandolf", "Ori", "Thorin". Switch places with Bilbo and Ori. Then, print that list.Then, squeeze Ori's brother between Gandolf and Bilbo. Print the list againThen, switch positions of Ori and Gandolf. Print the list againI tried doing it, but I don't think I'm doing it correctly.
Although Thorin is not actually Ori's brother, which you alluded to without saying it specifically (https://thorinoakens...so-hot-dwarves/), For the sake of your code question I will answer based on what you're looking for.
# Declare the list and print to console mylist = ["Bilbo", "Gandolf", "Ori", "Thorin"] print(mylist) # Get the Index of the two characters, and switch them. a, b = mylist.index('Bilbo'), mylist.index('Ori') mylist[b], mylist[a] = mylist[a], mylist[b] print(mylist) # Now "squeeze" Thorin between Gandolf and Bilbo, which only works because Gandolf is after Bilbo in this list. mylist.insert(mylist.index('Bilbo'), mylist.pop(mylist.index('Thorin'))) print(mylist)
['Bilbo', 'Gandolf', 'Ori', 'Thorin'] ['Ori', 'Gandolf', 'Bilbo', 'Thorin'] ['Ori', 'Gandolf', 'Thorin', 'Bilbo']
Also tagged with one or more of these keywords: python, coding
Computers →
Coding →
Learning Data Science with Python ProgrammingStarted by AI Patasala, 22 Dec 2021 Data Science, Python, Code and 2 more... |
|
||
Nerd Forum Information →
Introductions →
Hey, I'm a newbie hereStarted by codegeek, 02 Aug 2020 coding, programming, tech and 2 more... |
|
||
Computers →
Coding →
Cool infographic on popular coding languages - 2015Started by Big_T, 25 Mar 2015 java, javascript, asp.net, python and 6 more... |
|
||
Computers →
Coding →
ChallengeStarted by kia2600g, 29 Aug 2014 challenge internet and 9 more... |
|
||
Computers →
Coding →
ModdingStarted by gigatime, 17 Aug 2014 mods, modding, games, coding and 4 more... |
|