Python Programming Fundamentals

ResoluteDahlia avatar
ResoluteDahlia
·
·
Download

Start Quiz

Study Flashcards

18 Questions

What is the primary purpose of using databases?

To manage data efficiently

What is the term for the unique identifier for each record in a table?

Primary Key

What type of databases organize data into tables which can be linked by common fields?

Relational Databases

What is the term for the fraudulent attempt to obtain sensitive information by disguising oneself as a trustworthy entity?

Phishing

What is the concept of ensuring that information is accessible only to those authorized to have access?

Confidentiality

What is the recommended practice to ensure secure access to accounts?

Enabling two-factor authentication (2FA) where possible

What is the primary purpose of pseudocode in programming?

To plan and express algorithms before writing actual code

What is the data type of the input taken by the input() function in Python?

String

Which of the following is a rule for naming a variable in Python?

A variable name can only contain alpha-numeric characters and underscores

What is the purpose of the '==' operator in Python?

To check if two values are equal

What is the significance of binary code in computer programming?

It uses only two digits (1 and 0)

What is the purpose of the '//' operator in Python?

To perform floor division

What is the purpose of 'elif' in conditional statements?

To check additional conditions after the initial 'if' statement

What is the primary use of the range() function?

To generate a sequence of numbers for looping

How can you add something to a list?

Using the append() method or concatenation

What is the scope of a local variable?

It can only be accessed within the function it is declared

What shape represents a decision or conditional statement in a flow chart?

Diamond

What is the purpose of a loop in programming?

To repeatedly execute a block of code

Study Notes

Database Fundamentals

  • A database is a structured collection of data stored electronically.
  • Databases are needed to manage data efficiently, making data searching, sorting, and manipulation easy.
  • Common database issues include Data Redundancy, Data Isolation, Data Security, and Scalability Issues.

Database Components

  • Tables represent entities and relationships.
  • Fields are individual pieces of data within a table.
  • Records are rows in a table representing instances of entities.
  • Queries are used to retrieve specific data from tables.
  • Reports provide summarized views of data.
  • Forms are interfaces for data input.
  • Primary Key is a unique identifier for each record in a table.
  • Foreign Key creates relationships between tables.

Database Types

  • Relational Databases organize data into tables that can be linked by common fields.
  • Examples of Relational Databases include MySQL and Oracle.
  • NoSQL Databases have flexible schemas.
  • Examples of NoSQL Databases include MongoDB and Cassandra.

Security Threats

  • Malware is software designed to harm or exploit any programmable device, service, or network.
  • Phishing is a fraudulent attempt to obtain sensitive information by disguising oneself as a trustworthy entity.
  • Man-in-Middle Attack involves eavesdropping on the communication between two parties to steal or manipulate data.

Security Principles

  • Confidentiality ensures that information is accessible only to those authorized to have access.
  • Integrity assures the accuracy and reliability of information and systems.
  • Availability ensures that authorized users have access to information and resources when needed.

Security Best Practices

  • Use strong, unique passwords for different accounts.
  • Enable two-factor authentication (2FA) where possible.

Binary Code

  • Binary code uses only two digits: 1 and 0, which are called bits.

Ethics

  • Different ethical lenses include the right lens, the justice lens, the common good lens, the caring lens, the utilitarian lens, and the virtue lens.

Variables

  • Variables are containers for storing data values.
  • Rules for naming a variable include:
    • Starting with a letter or the underscore character
    • Not starting with a number
    • Containing only alpha-numeric characters and underscores
    • Being case-sensitive
    • Not being a Python keyword

Data Types

  • Variables can store different data types.
  • In Python, the data type for a variable is set when a value is assigned to it.

User Input

  • The input() function is used to take user input.
  • The input() function reads every input as a string unless it is cast into something else.

Pseudocode

  • Pseudocode allows developers to plan and express algorithms in a language-independent manner before writing actual code.
  • Pseudocode is written using simple language and structured like code, using statements, loops, and conditions.

Operators

  • Arithmetic operators include +, -, *, / (float), // (floor), and %.
  • Logical operators include And (&&), Or, and Not.
  • “=” is used to assign a value to a variable, while “==” is used to check if two values are equal.

Conditional Statements

  • Conditional statements are used to execute different actions based on different conditions.
  • 'else' is used to execute a block of code if the conditional statement is false.
  • 'elif' (short for else if) is used to check additional conditions after the initial 'if' statement.

Lists

  • Lists are used to store multiple items in a single variable.
  • To add something to a list, you can use the append() method or concatenation (+ operator).
  • To access an item from a list, you can use square brackets ([]) with the index number.

Loops

  • Loops are used to repeatedly execute a block of code.
  • The range() function generates a sequence of numbers that is commonly used for looping.
  • Using the range() function can be more memory efficient and provide more control over the loop iteration.

Variable Scope

  • A local variable is declared inside a function and can only be accessed within that function.
  • A global variable is declared outside of any function and can be accessed throughout the program.
  • The scope of a variable refers to where in the code it can be accessed and manipulated.

Flowchart Symbols

  • Rectangle: Represents a process or action.
  • Diamond: Represents a decision or conditional statement.
  • Parallelogram: Represents input or output.
  • Oval: Represents the start or end of a process.

Flowchart Representation

  • Conditional statements are represented by diamonds in a flow chart.
  • Loops are represented by arrows looping back to a previous point in the flow chart.

Test your understanding of Python programming basics, including conditional statements, lists, and indexing. Learn how to execute different actions based on conditions and work with lists in Python.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser