views:

139

answers:

2

ok so basically i very new to programming and have no idea how to go about these problems help if you will ^^

  1. Numerologists claim to be able to determine a person’s character traits based on the “numeric value” of a name. The value of a name is determined by summing up the values of the letters of the name, where ‘a’ is 1, ‘b’ is 2, ‘c’ is 3 etc., up to ‘z’ being 26. For example, the name “Zelle” would have the value 26 + 5 + 12 + 12 + 5 = 60 (which happens to be a very suspicious number, by the way). Write a program that calculates the numeric value of a single name provided as input.

  2. Word count. A common utility on Unix/Linux systems is a small program called “wc”. This program counts the number of lines, words (strings of characters separated by blanks, tabs, or new lines), and characters in a file. Write your own version of this program. The program should accept a file name as input and then print three numbers showing the count of lines, words, and characters in the file.

+4  A: 

I won't give you an answer, I want to help you:

Read the tutorial!

What you ask for is pretty basic and should be perfectly covered by the tutorial, especially read about strings and reading files.

Disclaimer: @Charles Beattie I am ok with a downvote ;) If anyone considers this not to be a valid answer I'll put it as comment, just say so.

Felix Kling
I agree with you! Charles, do not scary others if their answer gives hints only, and not a complete solution. +1 for tutorial links.
Michał Niklas
A: 

I'm not going to give you a full answer as well :)

I like Google's Python tutorial. In addition to small easy written tutorials, it has video lectures (which also covers strings and reading files). At the end of each topic, you can do simple exercises (provided on the tutorial page).

navlelo