0% found this document useful (0 votes)
52 views23 pages

Ceng1004 Introduction

This document contains the summary of the first lecture of the CENG1004 - Introduction to Programming course. It discusses the course information including grading, syllabus and expectations. It also introduces programming concepts such as program flow, algorithms, and programming languages. The key topics covered are Python installation, the benefits of Python, and basic programming terminology.

Uploaded by

ozlem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views23 pages

Ceng1004 Introduction

This document contains the summary of the first lecture of the CENG1004 - Introduction to Programming course. It discusses the course information including grading, syllabus and expectations. It also introduces programming concepts such as program flow, algorithms, and programming languages. The key topics covered are Python installation, the benefits of Python, and basic programming terminology.

Uploaded by

ozlem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

CENG1004 – Introduction to Programming

Lecture 1

Introduction

Spring 2023
Today

• Course information

• Why Python?

• Python Installation

• What is the programming?

• Program Steps or Program Flow


Course Information

Tentative Grading:

• 40% midterm
• 20% written midterm exam
• 10% quizzes (2)
• 10% homework

• 60% final
• 40% written final exam
• 10% quizzes (2)
• 10% homework
Course Information

Tentative Syllabus: Weeks Topics


Week-1 Introduction
Week-2 Variables, Expressions, Statements
Week-3 Conditionals
Week-4 Iterations
Week-5 Functions
Week-6 Strings
Week-7 Lists
Week-8 Files
Week-9 Dictionaries
Week-10 Tuples and Sets
Week-11 Lambda Functions and Regular Expressions
Week-12 NumPy and Pandas
Week-13 Plotting and Data Visualization
Week-14 Introduction to Machine Learning with Python
Course Information

• You have to follow course website for announcements, lecture notes


and homeworks.
• Course website:
https://online-learning.gidatarim.edu.tr/course/view.php?id=482

• To succeed:
• do practise
• PRACTISE. PRACTISE? PRACTISE!
• do not skip lectures
• do not be afraid writing code
Why Python?

python
Easy to learn
print('Hello, World!')
• Understandable and
easy to read code

• Extensive packages for public class Hello{


almost any task java
public static void main(String argv[]){
System.out.println('Hello, World!');
• It can work on }
different platforms }
(such as Windows,
Linux, macOS)
C language

#include <stdio.h>
int main(){
• Free
printf('Hello, World!');
return 0;
}
Python Installation

• You can use online compilers/IDEs


• Google Colab (recommended will be used in course)
• Jupyter Notebook (recommended)
• Python Fiddle
• PyFiddle
• Programiz

• You can download your own copy, it is free


• Download Python

• More advanced tasks (data science, machine learning)


• Download Anaconda
What is the programming?

• A program is a sequence of definitions and commands


• definitions evaluated
• commands executed by Python interpreter

• commands (statements) instruct interpreter to do something

• Programming: It is the determination and appropriate use of the


necessary commands to create a program.

• Programming Languages: They are programming tools that


specify the commands, definitions and rules used in the creation
of a program.
Stored Program Computer

• sequence of instructions stored inside computer


• built from predefined set of primitive instructions
1) arithmetic and logic
2) simple tests
3) moving data

• special program (interpreter) executes each instruction in order


• use tests to change flow of control through sequence
• stop when done
Program Steps or Program Flow

• Like a recipe or installation instructions, a program is a sequence


of steps to be done in order.

• Some steps are conditional - they may be skipped.

• Sometimes a step or group of steps is to be repeated.

• Sometimes we store a set of steps to be used over and over as


needed several places throughout the program (in the later
lectures).
Sequential Steps

❖When a program is running, it flows from one step to the next.


As programmers, we set up “paths” for the program to follow.
Conditional Steps
Repeated Steps

❖ Loops (repeated steps) have iteration variables that change each time
through a loop.
A program is a Recipe

Taken from: https://web.cs.hacettepe.edu.tr/~bbm101/fall19/lectures/lec4-python.pdf


Creating Recipes

• a programming language provides a set of primitive operations

• expressions are complex but legal combinations of primitives in a


programming language

• expressions and computations have values and meanings in a


programming language
Aspects of Languages

• primitive constructs
• English: words
• programming language: numbers, strings, simple operators
Aspects of Languages

• syntax
• English:
• "cat dog boy"
• not syntactically valid
• "cat hugs boy"
• syntactically valid

• programming language:
• "hi"5
• not syntactically valid
• 3.2*5
• syntactically valid
Aspects of Languages

• static semantics is which syntactically valid strings have meaning


• English: "I are hungry"
• syntactically valid
• but static semantic error

• programming language:
• 3.2*5
• syntactically valid
• 3+"hi"
• static semantic error
Aspects of Languages

• semantics is the meaning associated with a syntactically


correct string of symbols with no static semantic errors

• English: can have many meanings "Flying planes can


be dangerous"

• programming languages: have only one meaning but may not


be what programmer intended
Where things go wrong

• syntactic errors
• common and easily caught

• static semantic errors


• some languages check for these before running program
• can cause unpredictable behavior

• no semantic errors but different meaning than what programmer


intended
• program crashes, stops running
• program runs forever
• program gives an answer but different than expected
Algorithms

An algorithm is a step by step list of instructions that if followed exactly will


solve the problem under consideration.

For example, an algorithm to compute the area of a circle given its radius
might look like this:

Algorithm Example 1 (English)


1. Ask for radius
2. Compute area by squaring radius and
multiplying the result by pi
3. Display the computed area
Algorithms

Pseudocode is a notation that is more precise than English but generally


not as precise as a programming language. The same algorithm expressed
in pseudocode might look something like this:

Algorithm Example 2 (Pseudocode)


1. Ask for radius
2. let area = (radius2) × π
3. Display area
References

• Slides are adapted from


• https://web.cs.hacettepe.edu.tr/~muh101/
• https://ocw.mit.edu/courses/6-0001-introduction-to-
computer-science-and-programming-in-python-fall-2016/
• https://opencourses.emu.edu.tr/course/view.php?id=607#sec
tion-2
• https://www.py4e.com/lessons/intro
• https://web.cs.hacettepe.edu.tr/~bbm101/fall19/lectures/lec
4-python.pdf
• https://runestone.academy/ns/books/published/fopp/index.h
tml

You might also like