Académique Documents
Professionnel Documents
Culture Documents
Statements
Program
if (relative) if (relative)
{
if (my friend)
if (my friend)
cout << “both”; cout << “both”;
else }
else
cout << “neither”; cout << “neither”;
Formal and Natural Languages
Comments
• It is a good idea to add notes to your programs to explain in natural
language what the program is doing. These notes are called comments.
• they are marked with the # symbol:
•For eg:
# compute the percentage of the hour that has elapsed
percentage = (minute * 100) / 60
Questions ??
Programs
Write a single Python statement that combines the three strings "My
name is", "Joe" and "Warren" (plus a couple of other small strings) into
one larger string "My name is Joe Warren." and prints the result.