Printing output in Python
The first thing we are going to do is teach the computer to communicate with us. Computers can answer many different questions, and to accomplish that, we will learn how to interact with our computer to tell it to “talk” to us.
The commands in Python are very intuitive and are sometimes very similar to the English language. The first command we will cover in this course is the
We can use the
print()command to print text in the output. For instance, this program prints
Hi, my name is Python:
print('Hi, my name is Python')
Note that after
print()there is an opening bracket and a closing bracket at the end. This tells Python where the printing statement starts and ends. Between the brackets, we can put textual values which are inside either single quotes
''or double quotes
"". Python treats both single and double quotes the same. So, the following two programs are identical:
Both of these programs will print
Helloin the output.
Write a program that would print
Hi, I am starting to learn Pythonin the output.
To run the program, hit the
RUNbutton and see if the program behaves correctly. To evaluate the program hit the
SUBMITbutton. If everything is correct, the first exercise will turn green and will be marked as completed!
Note that the output of your program should exactly match the expected output.
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB