okay, i'm stuck on an assignment! (first post btw, so tell me if i'm doing anything wrong please :) )
okay, my assignment is as follows :
Write some efficient and commented python code to do the following:
Accept an input value between 33 and 126 and convert it to an integer
Output the number and its corresponding character; using the chr() function
Accept a word input
Output the length of the word using len()
Convert each character into its ASCII value
Add up all the character values and output the total
and so far i've only come up with
def check_input(low, high):
prompt = "Enter an integer number between %d and %d: " % (low, high)
while True:
try:
a = int(input(prompt))
if low <= a <= high:
return a
except ValueError:
print(prompt)
num_input = check_input(33, 126)
print(chr(num_input))
but this only accepts a number between 33 and 126, and displays the ascii character... any help would be much appreciated, especially on the accepting word input bit!!