Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Random Sentance Generator
Post: Random Sentance Generator
Hey guys so I need to write a Random Sentance Generator that reads
nouns.
adjectives,
adverbs,
conjunctions,
Intransitive verbs,
Leadin,
Nounmarkes,
Transitive verbs
From files that contain these p... |
|
Liquid_Ocelot |
Homework |
1 |
3,992 |
May-19-2017, 07:21 AM |
|
|
Thread: Trouble displaying items from lists
Post: RE: Trouble displaying items from lists
Quote:Incidentally, keeping "parallel arrays" like this is a well-known anti-pattern (you problem above is exactly one of the frequent pitfalls) and you should really be using a single array of "aggre... |
|
Liquid_Ocelot |
Homework |
8 |
6,479 |
May-18-2017, 07:37 AM |
|
|
Thread: Trouble displaying items from lists
Post: RE: Trouble displaying items from lists
(May-18-2017, 04:37 AM)Larz60+ Wrote: It looks as if names is a list.
try print(names) to see.
if so, you can find the index of the one you want by using index
idx = nicknames.index('nick')
del nick... |
|
Liquid_Ocelot |
Homework |
8 |
6,479 |
May-18-2017, 04:51 AM |
|
|
Thread: Trouble displaying items from lists
Post: RE: Trouble displaying items from lists
Thanks man I will check that out. Funny I have run into an entirely new problem now
I am trying to write a delete function that asks the user for the nickname they want to delete then deletes the co... |
|
Liquid_Ocelot |
Homework |
8 |
6,479 |
May-18-2017, 12:23 AM |
|
|
Thread: Trouble displaying items from lists
Post: Trouble displaying items from lists
So I am writing a code for an address book. I have a function that searches for a nickname of a person then prints their details if the nickname is in the list but I only getting the "contact does not... |
|
Liquid_Ocelot |
Homework |
8 |
6,479 |
May-17-2017, 10:42 PM |
|
|
Thread: Slicing to a file
Post: RE: User input slice
And removing the for loops in this case just displays the outfile with no text. Really stumped to what I am missing
import sys
print(" *** Truncating File Copy ***")
infile_name = input("Please enter... |
|
Liquid_Ocelot |
Homework |
11 |
8,439 |
May-13-2017, 10:51 PM |
|
|
Thread: Slicing to a file
Post: RE: User input slice
(May-13-2017, 11:50 AM)ichabod801 Wrote: You've pretty much got right there. If you've just got one list (and please don't name it list), then you can eliminate the for loops and it should work. Alt... |
|
Liquid_Ocelot |
Homework |
11 |
8,439 |
May-13-2017, 08:54 PM |
|
|
Thread: Slicing to a file
Post: User input slice
Does anyone know how to take user inputs and put that in to the slice method?. I know there are two numbers in the slice method separated by colon. The one on the left will remove elements on the left... |
|
Liquid_Ocelot |
Homework |
11 |
8,439 |
May-13-2017, 11:12 AM |
|
|
Thread: Slicing to a file
Post: RE: Slicing to a file
|
Liquid_Ocelot |
Homework |
11 |
8,439 |
May-12-2017, 10:51 PM |
|
|
Thread: Slicing to a file
Post: RE: Slicing to a file
(May-12-2017, 03:49 AM)nilamo Wrote: Get rid of lines 5 and 6. They do nothing, but open file handles that you never deal with.
I'd suggest massively simplifying your task, and just using strings ... |
|
Liquid_Ocelot |
Homework |
11 |
8,439 |
May-12-2017, 06:15 AM |
|
|
Thread: Slicing to a file
Post: RE: Slicing to a file
Seems I am still rather stuck on this. I have worked out how to add lines properly but I still am stumped by replacing the lines.
The instructions are stating:
Ask the user two questions before copy... |
|
Liquid_Ocelot |
Homework |
11 |
8,439 |
May-11-2017, 09:47 PM |
|
|
Thread: Slicing to a file
Post: Slicing to a file
Hey everyone just a quick question. I need to omit lines from a file where the number of lines is dictated by the user input then save it as a new file
I have the jist of editing files and saving them... |
|
Liquid_Ocelot |
Homework |
11 |
8,439 |
May-11-2017, 09:05 PM |
|
|
Thread: Spell Checker
Post: Spell Checker
Hey guys I need help with this program please :)
I need to
Turn the string into a list of lists, where each sublist has two elements (the mispelling and the correctly spelt word). This is your corre... |
|
Liquid_Ocelot |
Homework |
1 |
3,194 |
May-07-2017, 06:14 AM |
|
|
Thread: Formatting question regarding tables (Interest loan calculator)
Post: RE: Formatting question regarding tables
(May-07-2017, 12:59 AM)nilamo Wrote: It is rounding to the nearest 2 decimal places. But it's *also* printing the rate (2.0) before each one.
Thanks, see that now. I think I need a break lol
http... |
|
Liquid_Ocelot |
Homework |
14 |
10,283 |
May-07-2017, 01:05 AM |
|
|
Thread: Formatting question regarding tables (Interest loan calculator)
Post: RE: Formatting question regarding tables
(May-06-2017, 10:28 PM)Ofnuts Wrote: You typically don't use tabs for this (especially with number that should be aligned on the decimal dot). You use a format spec that force them to be padded wit... |
|
Liquid_Ocelot |
Homework |
14 |
10,283 |
May-06-2017, 10:42 PM |
|
|
Thread: Formatting question regarding tables (Interest loan calculator)
Post: Formatting question regarding tables
So if I want to make a table and allign the results in a row to something like years neatly what would I need to change
years = print("Years\t 1 \t\t2\t\t3\t\t4\t\t5\t\t6\t\t7\t\t8\t\t9\t\t10")
prin... |
|
Liquid_Ocelot |
Homework |
14 |
10,283 |
May-06-2017, 09:23 PM |
|
|
Thread: Help printing any items that contains a keyword from a list
Post: RE: Help printing any items that contains a keywor...
I edited the code a bit to make it a little easier hopefully. Although now im running into a problem with the keep function. It will work if used in the order of the commands but if I want to keep a r... |
|
Liquid_Ocelot |
Homework |
13 |
74,544 |
May-06-2017, 09:00 PM |
|
|
Thread: Help printing any items that contains a keyword from a list
Post: RE: Help printing any items that contains a keywor...
(May-06-2017, 07:43 PM)ichabod801 Wrote: You need elif, which is an abbreviation for 'else if'. It gives another condition to check if the previous conditions haven't been met.
menu()
selection = i... |
|
Liquid_Ocelot |
Homework |
13 |
74,544 |
May-06-2017, 07:48 PM |
|
|
Thread: Help printing any items that contains a keyword from a list
Post: RE: Help printing any items that contains a keywor...
matches = []
letter = input('Search title starting with the letter: ') # input is already returning a str, you don't need to convert it.
for movie in movies_list:
if movie.startswith(letter):
... |
|
Liquid_Ocelot |
Homework |
13 |
74,544 |
May-06-2017, 06:48 PM |
|
|
Thread: Help printing any items that contains a keyword from a list
Post: RE: Help printing any items that contains a keywor...
Just also wondering how I would go about Adding the last displayed movie from a list to a new list. so for e.g
If the last movie shown on output was
pulp fiction
How would I add this to a list
Wou... |
|
Liquid_Ocelot |
Homework |
13 |
74,544 |
May-06-2017, 04:06 AM |