CCC102: COMPUTER PROGRAMMING 2
Introduction to
Python Programming
Instructor:
MS. ILHAM GAMAL
01
Python is a high-level,
interpreted language.
Used for web
development,
automation, etc.
What is Simple syntax,
making it beginner-
Python? friendly.
Python is widely used
in various fields.
02
Input Function
input() always returns a string by default.
Use int() to convert input into an integer.
Use float() to handle decimal numbers.
03
Formatting Output
Getting User Input with Formatted Output
The input() function always returns a string. To work with numbers, you need to convert the
input.
Use formatted strings (f-strings) or format() for better output presentation.
04
Control Structures
if-else
Python uses indentation instead of {}
Syntax:
05
Control Structures
match
Works like switch-case in other languages.
New in Python 3.10:
06
Control Structures
while-loop
Repeats as long as the condition is True
Syntax:
07
Control Structures
for-loop
The loop runs for each value in the sequence. The for loop iterates over a sequence (like a list, tuple, or range).
Syntax:
08
Assignment
Write a program Send the .py file to
that asks for a user's ilhamomargamal@[Link]
name and age, then Subj:
Modify the
CCC102 - <section> | Input/Output
prints a greeting program to
with their age. classify them Due Date:
as child, teen, Feb. 18, 2025
or adult.
09