Python Əsas Sintaksisi

FineLookingParadox avatar
FineLookingParadox
·
·
Download

Start Quiz

Study Flashcards

5 Questions

Python-də blok düzəlişini müəyyən etmək üçün hansı sintaksis elementindən istifadə olunur?

İndentasiya

Python-də kommentlərin başlamasına səbəb olan simvol hansıdır?

Python-də dəyişənə məlumat tövsiyə edərkən hansı operator istifadə olunur?

=

Python-də ədədlərin növlərindən hansılar vardır?

İnteger, Float, String, Boolean və List

Python-də müqayisə operatorlarından hansıları vardır?

Müqayisə operatorları

Study Notes

Basic Syntax

  • Indentation: Python uses indentation (spaces or tabs) to define block-level structure.
  • Comments: Comments start with # and extend to the end of the line.

Variables and Data Types

  • Variables: Assigned using the assignment operator (=).
  • Data Types:
    • Integers: int (e.g., 1, 2, etc.)
    • Floats: float (e.g., 3.14, -0.5, etc.)
    • Strings: str (e.g., 'hello', "hello", etc.)
    • Boolean: bool (e.g., True, False)
    • List: list (e.g., [1, 2, 3], ['a', 'b', 'c'], etc.)

Operators

  • Arithmetic Operators:
    • + (addition)
    • - (subtraction)
    • * (multiplication)
    • / (division)
    • % (modulus)
    • ** (exponentiation)
  • Comparison Operators:
    • == (equal)
    • != (not equal)
    • > (greater than)
    • < (less than)
    • >= (greater than or equal)
    • <= (less than or equal)
  • Logical Operators:
    • and (logical and)
    • or (logical or)
    • not (logical not)

Control Structures

  • If-Else Statements:
if condition:
    # code to execute if condition is true
else:
    # code to execute if condition is false
  • For Loops:
for variable in iterable:
    # code to execute for each item in iterable
  • While Loops:
while condition:
    # code to execute while condition is true

Functions

  • Defining a Function:
def function_name(parameters):
    # code to execute when function is called
  • Calling a Function:
function_name(arguments)

Əsas Sintaks

  • İndentasiya: Python boşluqlar (fəzalar və ya sekme) blok səviyyəsində strukturunu təyin etmək üçün istifadə edir.
  • Şərhlər: Şərhlər # simvolu ilə başlayır və sətrin sonuna qədər uzulur.

Dəyişən və Məlumat Növləri

  • Dəyişən: Təyinat operatoru (=) istifadə edilərək ayrılandırılır.
  • Məlumat Növləri:
    • Ədədlər: int (məsələn, 1, 2, və s.)
    • Ümumi Ədədlər: float (məsələn, 3.14, -0.5, və s.)
    • Strlar: str (məsələn, 'hello', "hello", və s.)
    • Bool: bool (məsələn, True, False)
    • Siyahı: list (məsələn, [1, 2, 3], ['a', 'b', 'c'], və s.)

Operatorlar

  • Aritmetik Operatorlar:
    • + (əlavə edilmə)
    • - (çixma)
    • * (vurma)
    • / (bölünmə)
    • % (qrəm)
    • ** (üstləmə)
  • Müqayisə Operatorları:
    • == (bərabər)
    • != (bərabər deyil)
    • > (böyük)
    • = (böyük və ya bərabər)
    • < (kiçik)
    • <= (kiçik və ya bərabər)

Python proqramlaşdırma dili üçün əsas sintaksisi haqqında məlumat. Bu mövzuda daxil olan mövzular indentation, comments, dəyişənlər və məlumat növləri adını çəkir.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Python Syntax and Basics
5 questions
Python Programming Basics
5 questions
Python Programming Basics Quiz
3 questions
Python Basic Syntax Quiz
6 questions
Use Quizgecko on...
Browser
Browser