"hello"
123
1 + 2
hello
print("Hello World!")
print(33 * 44)
print("33 * 44 = ", 33 * 44)
print("33" + "44")
first_name = input("Please enter your name: ")
print("Hello, " + first_name)
you need to use built in conversion functions such as int(), float() or str()
# Add Two Numbers Program
# This program will caculate the sum of two numbers
#
# by Derek Peacock
print("Please enter two numbers")
first_number = int(input("First Number:"))
second_number = int(input("Second Number: "))
sum = first_number + second_number
print()
print("The sum of the numbers = ", sum)
print()
# VAT Calculator
# This program will calculate the total cost of goods including VAT
#
# by Derek Peacock
cost = input("Please enter the cost without VAT: £")
cost = float(cost)
total_cost = float(cost) * 1.20
print("The total cost is = £", total_cost)
print()
this example shows how to format numerical output. It is not easy to get the euro symbol as it is not available on the keyboard.
# Euro Calculator
# This program will convert British Pounds to Euros
#
# by Derek Peacock
print("-" * 60)
print("\tDerek's Euro Calculator")
print("-" * 60, "\n\n\n")
amount = input("Please enter the amount in British Pounds: £")
print()
amount = float(amount)
euros = amount / 0.8838
# Two ways of printing in a particular format
print("You will get £{:0,.2f} euros for £{:0,.2f}".format(euros, amount))
print("You will get %1.2f for £ %1.2f " %(euros, amount))