INF 1511 VISUAL PROGRAMMING CH 1 Flashcards
CHAPTER 1
Create a variable monthly_savings, equal to 10 and num_months, equal to 4.
Multiply monthly_savings by num_months and save it to new_savings.
Add new_savings to savings, saving the sum as total_savings.
Print the value of total_savings.
Create the variables monthly_savings and num_months
monthly_savings=10
num_months=4
Multiply monthly_savings and num_months
new_savings = monthly_savings * num_months
Add new_savings to your savings
total_savings = savings + new_savings
Print total_savings
print(total_savings)
Multiply monthly_savings and num_months
new_savings = monthly_savings * num_months
Add new_savings to your savings
total_savings = savings + new_savings
Print total_savings
print(total_savings)
140
Create a new float, half, with the value 0.5.
Create a new string, intro, with the value “Hello! How are you?”.
Create a new boolean, is_good, with the value True.
Create a variable half
half=0.5
Create a variable intro
intro=”Hello! How are you?”
Create a variable is_good
is_good=True
Create a variable half
half=0.5
Create a variable intro
intro=”Hello! How are you?”
Create a variable is_good
is_good=True
define python programming langauage
it is a powerful high level, interpreted, interactive, dynamic object oriented programming language
what is a high level programming language vs low level
is designed to simplify computer programming and make it more accessible to humans. closer to human languages and further from machine languages
-low level is closer to binary code
interpreted vs compiled and transcompile and what is it used for
this is how a computer executes code
-INTERPRETED Languages: These languages (e.g., Python, Ruby, JavaScript) are executed directly by an interpreter without prior compilation. the source code is not directly translated by the target machine. Instead, a different program, aka the interpreter, reads and executes the code. therefore, it supports a complete debugging and diagnostic environment making the job of fixing mistakes much faster. Also, the software development is quite rapid and flexible in it.
-Compiled Languages: Code is transformed into machine code (executable) before execution. Examples include C, C++, and Java.
compiled language, the target machine directly translates the program.
-Transcompile Languages: These languages convert source code from one language to another (source-to-source translation).
what is interactive or dynamic
-An interactive programming language is a type of language that allows developers to interact directly with the program as they write it
REPL
Read ,evaulaute print loop
Allows you to run Python code interactively while working on a project or learning the language. This tool is available in every Python installation, so you can use it at any moment.
What are the features of python
-Python is easy to learn
-It has easier to read syntax.
-It uses white space
-Python is free. open-source model.
-Python can be integrated with other languages
-Python is an interpreted language
-Python is a good choice for web development, networking, games, data processing, and business applications
-For efficient memory management, Python uses garbage collection,
-Python supports exception handling
What is script or scripting
python can do RAPID APPLICATION DEVELOPMENT.
A SCRIPT usually consists of a few lines of codes, and it solves a very specific problem. automate small tasks extract info from a set of data manipulation of files and directories scrape data from a website
Mutable Data Types
Data types in python where the value assigned to a variable can be changed
eg.list ,set, dictionary,bytearray
Immutable Data Types:
Data types in python where the value assigned to a variable cannot be changed
eg .numeric(integers,floats complex) ,string, tuple,range
what code to use to see data type of a variable IE BOOLEAN ,INTEGER ,STRING
Type ( ) insert the object into the bracket
LITERALS in Python
- is defined as the raw data assigned to variables or constants while programming.
-We mainly have five types of literals which includes string literals, numeric literals, boolean literals, literal collections and a special literal None.
A literal is a number or string that appears directly in a program. The following are all literals in Python:
10 # Integer literal
10.50 # Floating-point literal
10.50j # Imaginary literal
eg.Variable eg X=10 (the entire thing is a variable)
Literal is 10
Identifier is set by ‘programmer user’ which means the same as ‘python keyword’ eg the ‘X”
explain what is a identifier
-A Python identifier is a name used to identify a variable, function, class, module or other object.
-An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9). ——-Python does not allow punctuation characters such as @, $, and % within identifiers
-Cannot start with a number
-it is the same as the keword used by python but called a variable which the programmer assigns
what is a variable
Variables are used for storing data in a program.
To set a variable, you choose a name for your variable, and then use the equals sign followed by the data that it stores.
Variables can be letters, numbers, or words. For example,
1 = 10
length = 10
length_rectangle = 10.0
k=”Hello World!”
how many keywords are there
35
all in lowercase except for true and false
list the keywords first 10 a-d
and as assert async await break class continue def del