Programming in STEM 1502
16 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the name of the main control of the Python Development Environment?

IDLE

What is the primary function of a compiler in programming?

To convert source code into object code or machine code.

Python is known for its complex and verbose syntax.

False

What are the two major programming techniques discussed in the content?

<p>Procedural programming and object-oriented programming</p> Signup and view all the answers

What is Python's typing system called?

<p>Dynamic Typing</p> Signup and view all the answers

What does the pound sign (#) indicate in Python code?

<p>A comment</p> Signup and view all the answers

Which of the following is NOT a valid data type in Python?

<p>Arrays</p> Signup and view all the answers

Python is a general-purpose programming language.

<p>True</p> Signup and view all the answers

What is the most common way to execute a line of code in Python's interactive window?

<p>Press the Enter key</p> Signup and view all the answers

What is the name of the command used to display output to the screen in Python?

<p>print</p> Signup and view all the answers

What does the command prompt symbol " >>> " signify in Python's interactive window?

<p>Python is ready for input.</p> Signup and view all the answers

Python is case-sensitive, meaning that "print" is different from "Print".

<p>True</p> Signup and view all the answers

Name the file used to store a Python script.

<p>A Python file typically has a <code>.py</code> extension.</p> Signup and view all the answers

How can you execute Python code within the IDLE window?

<p>Enter the code and press Enter</p> Signup and view all the answers

What is the purpose of using variables in programming?

<p>To store and manipulate data within a program.</p> Signup and view all the answers

What symbol is used to assign a value to a variable in Python?

<p>The equals sign (=)</p> Signup and view all the answers

Study Notes

Course Information

  • Course Title: Problem Solving in Science and Technology - STEM 1502
  • Course Description: Introduction to Programming
  • Instructor: Ms. Anuththara Dikovita
  • Department: Department of Information and Technology
  • Faculty: Faculty of Computing

Learning Outcomes

  • LO1: Critically analyze complex problems in science and engineering, identifying key issues and variables.
  • LO2: Formulate and present effective solutions to disciplinary problems, demonstrating strong communication skills.
  • LO3: Accurately compute and solve numerical problems, visualizing and interpreting results using appropriate IT applications.
  • LO4: Demonstrate proficiency in various IT applications relevant to science and engineering, showcasing practical application of these tools.

Book Resources

  • Thinking Skills: Critical Thinking and Problem Solving (Butterworth, 2013)
  • Microsoft Office 365 All-in-One for Dummies (Weverka, 2022)
  • Python for Data Analysis (McKinney, 2022)
  • Learning Python (Lutz, 2013)
  • Successful Problem Solving for AQA AS ICT (Lyon, 2008)

Programming Techniques

  • Programming began in the 1940s using memory addresses and machine code.
  • Higher-level languages were developed allowing for English-like instructions.
  • Early programs were monolithic, running from beginning to end.
  • Newer programs use modules that combine to form larger programs.
  • Two major programming techniques exist: procedural and object-oriented programming.
  • Both methods utilize reusable program modules

Programming Language

  • A programming language is a set of instructions allowing humans to interact with computers.
  • Programming code resembles instructions or to-do lists.
  • It enables creation of complex shapes and graphics.

Procedural Programming

  • Focuses on procedures to instruct a device on how to complete a task in logical steps.
  • Uses a linear approach.
  • Treats data and procedures as distinct entities.
  • Examples include C, FORTRAN, Pascal, and Basic.

Object-Oriented Programming

  • Emphasizes objects that represent real-world elements and their attributes and behaviors.
  • Organizes software design around data (objects) compared to functions.
  • Examples include C++, Java, and C#.

Machine Language

  • Machine language controls the computer's on/off circuitry.
  • It is the only language a modern computer understands.

Compiler vs Interpreter

  • Compilers: Convert an entire program into machine code (object code) before execution. The code is stored in a file. Examples: C, C++, C#.
  • Interpreters: Convert code into machine code during program execution, making memory use efficient. Examples: Perl, Python, MATLAB.

Python

  • Created by Guido van Rossum in 1990.
  • Named after Monty Python's Flying Circus.
  • Widely used in industry and academia.
  • Simple, concise and intuitive syntax with an extensive library.
  • General-purpose language applicable to any programming task.
  • Now used in Google search, NASA and in financial transactions at the New York Stock Exchange.
  • Python is object-oriented with features such as polymorphism, operation overloading and multiple inheritance support

Python Development Environment (IDLE)

  • Main control of the Python development environment
  • Interactive editor window that displays results following commands
  • Other editors can be accessed from IDLE
  • IDLE is available in most Python versions

Using IDLE

  • Python command prompt (or interactive window) displays >>> to indicate acceptance of input.
  • Type code, press Enter, and observe the output

Special Characters in Python

  • Python is case sensitive.
  • Opening and closing parentheses are used with functions.
  • The pound sign precedes comment lines.
  • Quotation marks enclose strings.
  • Paragraph comments are also used
  • The simplest program in most languages is to display a message to the screen.
  • Python uses the 'print' command to fulfill this task.

Variables

  • A variable is a memory location that stores data values.
  • A value is stored until it is changed.
  • Each variable can only hold one item of data.
  • Variables can be named to represent their memory locations in a human-friendly fashion (e.g., wife'sBirthday).

Variable Naming Rules

  • Variables must start with a letter or underscore, optionally followed by letters, digits, or underscores.
  • Using meaningful names (e.g., date_of_birth, noOfDwarves) is recommended for clarity.
  • Variable names cannot include spaces.
  • Reserved Python keywords (e.g., class, def, print) cannot be used as variable names.

Assignment of Values

  • The equals sign (=) is used to assign values to variables.

Working with Variables

  • Values can be modified within variables.
  • Initializing a value into a variable: sum = 12
  • Updating a variables value: sum = sum + 1`
  • String variables can be combined or assessed.

Python Data Types

  • Python automatically identifies the data type of variables.

  • Numbers( floats or integers)

  • Strings

  • Lists

  • Tuples

  • Dictionaries

  • Objects

  • Modules

Python Types

  • Python automatically determines data types; these are enforced after evaluation

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Description

This quiz focuses on the essential programming concepts taught in STEM 1502. Students will apply their knowledge to analyze and solve complex problems using IT applications. Effective problem-solving and critical thinking are emphasized throughout the quiz.

More Like This

Use Quizgecko on...
Browser
Browser