there are three (3) different types of commenting styles. What are they?
In-line - ANSWER-"Comments used to add meaning to a program and explain
logic in-line with the code being discussed. These comments are good for
quick explanations and are indicated by using the # character and a space. if
n % 2 == 1: # n is odd"
Multiline - ANSWER-"Comments, also known as block comments, are good for
more in-depth explanations or when you want to comment a complex section
of code. In Python we append together a section of lines all beginning with
the # character to achieve this. # This section of code # Requires a longer
comment # So we can add as many lines as needed"
,Document Strings (Docstrings) - ANSWER-"These are used like the comments
referenced above but it allows you much more space to write a longer
message and they can be written out at runtime, which means the
interpreter does see them, unlike other types of comments. These should be
used to describe what a piece of code is doing in detail. You enclose these
types of comments in three quote marks """""".
Interactive interpreter - ANSWER-A program that allows the user to execute
one line of code at a time.
Code (Coding) - ANSWER-A common word for the textual representation of a
program.
Line - ANSWER-A row of text.
The interactive interpreter displays a prompt(">>>") - ANSWER-(">>>")
that indicates the interpreter is ready to accept code.
def odd_function(n) - ANSWER-""""""This function checks to see whether a
number is odd or even"""""""
,Computer program - ANSWER-Consists of instructions that a computer
executes (or runs), like multiplying numbers or printing a number to a
screen.
Task decomposition - ANSWER-Means to reduce a complex task into simpler
basic steps, making the whole task easier to solve.
Algorithm - ANSWER-Is a methodical step-by-step procedure to perform a
task.
Computational thinking - ANSWER-The method of evaluating a problem's
most basic parts and then creating an algorithm to solve that problem.
Python interpreter - ANSWER-For Python, an application that can be used on
various operating systems, including Microsoft Windows, Linux, and MacOS.
Prompt - ANSWER-Informs the programmer that the interpreter is ready to
accept commands.
, statement - ANSWER-A program instruction.
True - ANSWER-True or false. A program mostly consists of a series of
statements, each statement usually appears on its own line.
False - ANSWER-True or False. Text in string literals may not have letters,
numbers, spaces, or symbols like "@" or "#".
print('Hello', end = ' ') - ANSWER-Multiple print statements will each print on
a new output line. How would you keep the next print's output on the same
line separated by a single space?
True - ANSWER-True or False. A string literal can be surrounded by matching
single or double quotes: 'Python rocks!' or "Python rocks!". Good practice is
to use single quotes for shorter strings, and double quotes for more
complicated text or text that contains single quotes (such as print("Don't eat
that!")).
Expression - ANSWER-Code that returns a value when evaluated; for
example, the code wage * hours * weeks is an expression that computes a
Voordelen van het kopen van samenvattingen bij Stuvia op een rij:
Verzekerd van kwaliteit door reviews
Stuvia-klanten hebben meer dan 700.000 samenvattingen beoordeeld. Zo weet je zeker dat je de beste documenten koopt!
Snel en makkelijk kopen
Je betaalt supersnel en eenmalig met iDeal, creditcard of Stuvia-tegoed voor de samenvatting. Zonder lidmaatschap.
Focus op de essentie
Samenvattingen worden geschreven voor en door anderen. Daarom zijn de samenvattingen altijd betrouwbaar en actueel. Zo kom je snel tot de kern!
Veelgestelde vragen
Wat krijg ik als ik dit document koop?
Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.
Tevredenheidsgarantie: hoe werkt dat?
Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.
Van wie koop ik deze samenvatting?
Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper NursingTutor1. Stuvia faciliteert de betaling aan de verkoper.
Zit ik meteen vast aan een abonnement?
Nee, je koopt alleen deze samenvatting voor €17,57. Je zit daarna nergens aan vast.