![]() |
|
#1
|
|||
|
|||
little help in pythonHello people, I was just browsing around looking for help online for similar problems to help me complete some problems for class.
I m new to python and some of this stuff is so confusing to understand. i have 4 problems i need help with and wondering if anyone can help me out with it ?? here are the problems. 1.Write a program that reads from the user n positive numbers, where n is an integer-value specified by the user as input, and outputs the largest number among them. 2.write a program that reads a string lower_string whose characters are all lower-case characters, and computes the string upper_string, which is the string lower_case with every character in it replaced by its corresponding upper-case character. you can assume that the characters in lower_case are chosen from the English alphabet characters {a,....,z}. 3.suppose the each line in the file "grades" contains the first name and the last name of a student followed by his numerical grades on 3 tests. Write a program that outputs to the file "final_grades" the name (first and last) of each student and next to it his alphabetical grade. you can assume the standard grading scheme(A=90-100, etc....) For this problem i have some of it done but im getting a error for the name of the variable, not sure what im doing wrong here but if anyone can fix it .. I would be really happy. I don't really know how to output the program. here it is. Python Code:
4. Write a program that takes as input a file and counts the number of characters, words, and lines in the file. I have half of this problem done but just get the other have done. and last one. Write a program that takes as input the binary representation of a positive integer n and outputs its decimal representation. For example, if the user inputs 1101 then the output should be 13. If anyone can help me with these problems.. I would much appreciate it. Thank you Last edited by LuciWiz : 10-Feb-2008 at 04:26.
Reason: Please insert your Python code between [py] & [/py] tags
|
|
#2
|
|||
|
|||
Re: little help in pythonanybody ?? man im soo stressing out over this stuff
|
|
#3
|
||||
|
||||
Re: little help in pythonYou do realize that you have to wait more than 1 1/2 hours for a response, right? People don't just hang out waiting to answer questions. Also, take a look at this thread before posting homework questions.
Regarding your coded for problem #3, you're code isn't written in Python. For one thing, Python doesn't require a def main(): block nor does it use if/else statements. Take a look at this code sample and see what I mean. If you want to include what you've written so far, or at least what exactly you're having problems with, we'll be glad to help as best we can. However, we won't do your homework for you, otherwise you won't learn anything. __________________
Common Sense v2.0-Striving to make the world a little bit smarter. |
|
#4
|
|||
|
|||
Re: little help in pythonok i got this homework straightly done. i ll post up the codes when i get a chance. we do use the def (): thing.. i dont know but thats how im thought in class.. teacher just explains the chapter and then tells use to do the example problems... doesn't really show us how the problem is done or show us a example kinda like the problem given.. His teaching is terrible. It's like how r we suppose to learn if you just show us a powerpoint with nothing on it almost and then make us write a code. you know.
|
|
#5
|
||||
|
||||
Re: little help in pythonCheck out the tutorials I wrote on Python. It may help you out some.
Normally, the def main(): line is not part of Python; it comes from C/C++. Technically it will work in Python since all you're doing is defining a function called "main". The parenthesis hold the arguments you would pass into the function. But it's very confusing and not Python-centric. A better way it so give the function a more descriptive name, such as "final_grades". However, the if/else also come from C/C++. Python uses if/elif statements to do the same thing; tried writing a Python script with if/else to to see and I got syntax errors. I would suggest getting a Python programing book for reference. Check out O'Reilly or Deitel. __________________
Common Sense v2.0-Striving to make the world a little bit smarter. |
Recent GIDBlog
Meeting the populace by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Neutral Python book - the Quest for the Impossible? | Kimmo | Python Forum | 1 | 04-Aug-2007 12:56 |
| Re: Beginning Python Tutorial (Part 9) | crystalattice | Python Forum | 0 | 19-Feb-2006 01:04 |
| Re: Beginning Python Tutorial (Part 5) | crystalattice | Python Forum | 0 | 04-Oct-2005 04:27 |
| Re: Beginning Python Tutorial (Part 1) | crystalattice | Python Forum | 5 | 01-Aug-2005 17:14 |
| Re: Beginning Python Tutorial (Part 2) | crystalattice | Python Forum | 2 | 31-Jul-2005 12:25 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The