print("Hello World!")
Hello World
print is not the same as PRINT
print is a function where it outputs strings, integers, decimals, and mathematical
calculations.
You can use the (+) operator to "add" or contacatenate two or more string together. It also allows you to place strings and variables together.
print("Hello" + "World!")
OUTPUT: HelloWorld!
Example:
name = "Ms. Friedman"
print ("Hello" + name)
OUTPUT: Hello Ms. Friedman
print (6 * 7 + 3)
OUTPUT: 45
print(10+5*7-2)
OUTPUT: 43
\
Comments are text that are ignored by the programmer.
Developers use comments to describe the program and the functionality of certain blocks of code.
It is also used to aid new developers who are newly hired into the team.
In Python there are two different ways of adding comments.
For single line comments the #
is used
Example:
#This is a comment
To add comments with multiple lines, use three quotes at the beginning and at the end of the comments.
Example:
""""
This is an example of
comments on multiple lines
""""
num1 = 12
LastName = "Friedman"
String Input
word = input()
or
word = input("Enter a word: ")
Example Run:
Enter a word: Computer
Integer Input
num = int(input("Enter a number: "))
Decimal Input
num = float(input("Enter a number: "))