Python Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

What are three purposes of comments?

1.Comments can be used to explain Python code 2.Comments can be used to make code more readable 3.Comments can be used to prevent execution when testing code

What are 5 advantages of Python?

1.Python works on many different platforms(Windows,Mac,Linux,Raspberry Pie,etc.) 2.Python has a simple syntax very similar to the English language 3.Python has syntax that allows developers to write programs with fewer lines of code than other programming languages 4.Python runs on a interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be done very quickly. 5.Python can be treated in a procedural way, an object oriented way, or a functional way.

What is one purpose of comments?

1.To tell the computer to ignore

What are two ways you can do a multi line comment in Python?

1.insert a # for every line ex: #This is #a #multiline comment 2.Using a multi line string """ """, since Python will ignore string literals that are not assigned to a variable, you can add multi line string(triple quotes) in your code, and place your comment inside of it Ex- """ This Is A Multi line comment """

When was python created?

1991

What sign do we use to store a value inside a variable?

=

True or False: Python has a command for creating a variable

False Python has no command for creating a variable

True or False: Python will not give you a error if you do not indent when you are doing something that requires it like an if

False you will get a error if you do not indent when are doing something that requires it like an if

Who created Python?

Guido van Rossum

What is the name of this variable? hobby = "Tree Shaping"

Hobby

How do we know if a value is a String?

If it has double quotes

What does Python use to indicate a block of code?

Indentation

What are lines of code?

Instructions for the computer

What does IDE stand for?

Integrated Development Environment

How many spaces do you have to indent in Python?

It is up to you but it has to be at least one

Where is the name of a variable right side or left side?

Left

Do you need a semicolon at the end of the line in Python?

No

How do you output text in Python?

Print("Hello World")

How does Python define scope?

Python relies on indentation using white space to define scope; such as the scope of loops, functions and classes

How does Python complete a command?

Python uses new lines to complete a command, as opposed to other programming languages that use semicolons or Parentheses.

Where is the value of a variable what side left or right?

Right

What is the type of this variable? Hobby = "Tree Shopping"

String or str

What is indentation?

The spaces at the beginning of the code line

What is happening in this statement? Hobby = "Shopping"

The variable Hoppy is set to a value of Shopping

What are variables used for?

To remember information

What is the value of this variable? Hobby = "Tree Shopping"

Tree Shopping

True or False: A comment does not have to be text that explains the code it can also prevent Python from executing code?

True

True or False: Comments can be placed at the end of the line and Java will ignore them?

True

True or False: Python is a popular programming language

True

True or False: Strings can contain all sorts of characters?

True

True or False: Variable names can not have spaces

True

True or False: Variable names should be descriptive?

True

True or False: When we store a value inside a variable, it is like putting stuff in a box?

True

True or False: Python is very readable

True Python was designed for readability and has some similarities to the English language with influence from mathematics.

True or False: Indentation in Python is very important

True: Where in other programming languages the indentation in code is for readability only,the indentation in Python is very important

What is snake case?

Using a underscore _ to connect two variable name words

What do we run code?

We tell the computer to follow the instructions we put together

When are variables created in Python?

When you assign a value to it

What are Strings?

Words with double quotes

What is a interpreter language with regards to Python?

You write Python files in a text editior and then put those files in the Python interpreter to be executed

What are some more things you can use Python for?

automating tasks,getting ahead with data analysis,machine learning,and much much more.

What symbol does comments start with in Python?

#

Give a example of using comments to make Python ignore code?

#Python will not execute the print statement below because it is commented out #print("Hello World")

How do you do a single line comment in Python?

#This is a single line comment

Give a example if statement

if 5>2: print("Five is greater than 2")

Give an example of a indentation error in Python?

if 5>2: print("5 is greater than 2") #You must indent

Give a example of a int variable in Python?

x = 7 print(x)

Give a example of a string variable in Python?

y = "Hello World" print(y)

What can Python do?

•It can be used on a server to create web applications •It can be used alongside software to create workflows •It can connect to database system •It can read and modify files •It can handle big data •It can perform complex mathematics •it can be used for rapid prototyping •it can be used for production ready software development

What can Python be used for?

•Web development server side •Software development •mathematics •system scripting


Conjuntos de estudio relacionados

ITN 257- AWS Cloud Computing: Infrastructure and Services

View Set

NR224 Fundamentals 1 Final Review

View Set

Word Processing Essentials Exam Review

View Set