Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 911 Bytes

File metadata and controls

46 lines (33 loc) · 911 Bytes

Simple Adder Program

This Python program allows you to add two numbers of your choice. Follow the instructions to input values for 'a' and 'b', and the program will display the result.

Instructions:

  1. Run the program.
  2. Enter a value for 'a' when prompted.
  3. Enter a value for 'b' when prompted.
  4. View the result of the addition.

Code Snippet:

# Welcome text
print("Welcome to your simple adder.")
print("-----------------------------")

# Input for 'a'
a = input("Enter a value for a: ")

# Input for 'b'
b = input("Enter a value for b: ")

# Display inputs
print(f"\nValues entered:\n  a = {a}\n  b = {b}")

# Calculate and display the result
result = int(a) + int(b)
print(f"\nThe result is: {result}")

Example:

# Run the program
# Enter a value for a: 100
# Enter a value for b: 50

# Output:
# Values entered:
#   a = 100
#   b = 50

# The result is: 150