Module_2
- Angela Porcelli
- Jan 23, 2021
- 1 min read
Updated: Mar 12, 2021
Original Codes:
1 line: Output
print ('Hello, world!')2 line # Creating a String
# with single Quotes
String1 = 'Welcome to the Geeks World'
print("String with the use of Single Quotes: ")
print(String1)
The first code can be entered into Python exactly as it is written. The code is telling the interpreter to return the line
Hello, world!
2. The second code contains unnecessary lines for producing the intended return line of
Welcome to the Geeks World
The first two lines are leaving notes for the programmer, however, this could more efficiently be written in one note as
# Creating a String with single Quotes
In the next line (String1 = 'Welcome to the Geeks World') is assigning the argument 'Welcome to the Geeks World' to the function String1.
The following line of code (print("String with the use of Single Quotes: ")) is unnecessary for the intended goal. This line of code is telling the interpreter to return the line:
String with the use of Single Quotes
which is a description of the argument not what the programmer is desiring to be returned.
Since the argument 'Welcome to the Geeks World' has already been assigned to the function String1, the last line in the code is simply telling the interpreter to return the line
Welcome to the Geeks World




Comments