User Profile
Collapse
-
I'm sorry to be slow, but I understand the first part...but where does the printForward(li st), printReverse(li st), etc. come in? Or is that the functions I'm supposed to be writing? Thank you again for the help. -
Write a Source File with a lot of directions attached
So here is the question:
Write a python source file that defines functions, printForward(li st), printReverse(li st), and getLength(list) , which prints the elements of a list (one element on each line) in order, prints the elements of a list in reverse order, and returns the number of elements in the list, respectively. Write another Python source file (which can be executed from the command line) that imports the original module... -
Improve my Functions?
Trying to set up a file for questions and answers. Doesn't seem to be working properly. Can anyone see where I can improve my functions? This is what I have so far:
questionFile = open('questions .txt')
numberQuestionD ictionary = {}
for line in questionFile.re adlines():
if not line:
continue
line = line.strip()
if len(line) == 0:
continue
numberAndQuesti on... -
ah, ok seeing your example I understand it better.
Thank you...I really appreciate the help!Leave a comment:
-
return length of string with given index????
This is the exact question given...I wish I could start or make a stab, but I don't know where to begin:
Submit a Python file named, 'countDemo.py', that defines and demonstrates a function that takes a list of strings and an index and returns the length of the string with the given index. If the index is not valid, the function should return a value of -1.
Thank you in advance for any help or insight anyone can gi... -
I think I'm making this much harder than it is.....what I've been working on for hours you told me in a couple of minutes....THAN K YOU SO MUCH!!!!Leave a comment:
-
{SOLVED} Program to print 't' and 'T' in a text file
I got such good help here before (thank you)....thought I'd try it again.
I'm supposed to have a text file to read....I named it my_file.txt
I need to write a Python program to read the file and print every word that begins with a 't' or 'T'.
This is what I have so far:
uselessFile = open('my_file.t xt', 'r')
>>> uselessList = uselessfile.rea dlines()
>>> uselessList... -
Thank you so much! I have been working on that question for the last 2 hours. Your response works perfect!
I really appreciate the help!!!!
= )Leave a comment:
-
Sorry...I wrote the question exactly as my homework ask it. Maybe thats why I feel lost:
I guess I should have a list ['eggs', 'Spam', 'Spam', 'eggs', 'Sam', 'eggs', 'eggs', 'Spam', 'Spam', 'eggs', 'eggs', 'Spam', 'eggs', 'Spam', 'Spam', 'eggs', 'spam',.......]
but I need to find out how to write that I want the multiples of 3 and 5 to say eggs and all the rest to say Spam.
Hope that is clearer........Leave a comment:
-
'Spam' and 'Eggs' (the list) [solved]
I need to generate a list containing 500 words. Each word should be, 'Spam', unless the index of the word in the list is a multiple of 3 or 5. In which case the word should be, 'eggs'. The index of the first word is 0.
Anyone know where I should start?
Thanks in advance for the help.
No activity results to display
Show More
Leave a comment: