hey guys i need mad help with this! im soo lost and stressed out over this and not understanding how to do this. Can anyone help me with this ???
I m new to python and some of this stuff is so confusing to understand.
i have 4 problems i need help with
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.
import stringlibrary
def main():
infile=open("grades.txt",'r')
for line in file:
fname=string.split(line)[0]
lname=string.split(line)[1]
test1=string.split(line)[2]
test2=string.split(line)[3]
test3=string.split(line)[4]
answer=(eval(test1)+eval(test2)+eval(test3)/3.0)
if (answer>=90):
grade="A"
else:
if (answer>=80):
grade="B"
else:
if (answer>=70):
grade="C"
else:
if(answer>=60):
else:
grade="F"
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