Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Program: convert_text_toNumber.py
- ## Created by Carson Young for CPSC 215
- # January 12, 2015
- #Input: from the keyboard, symbols valid for a number (0...9, +, -0
- #process: Convert the characters input to a number using eval()
- # add one to the number
- #Output: The original string
- # The string converted to a number
- # The result of adding 1 to the number
- def main():
- print("This program inputs characters valid for a number, the converts")
- print("the string to a number. It adds one to the number and prints it.")
- print()
- number = input("Input a set of characters valid for a number: ")
- #convert the string that was input to a number
- number = eval(number)
- print(number)
- print()
- print("Now we will take your value and add 1 to it.")
- number = number + 1
- print(number)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement