Python-1 dars



Yüklə 225,97 Kb.
tarix12.09.2022
ölçüsü225,97 Kb.
#63589

Python-1 dars

Python Kurs haqida

Python -ni ishga tushiring

Python sintaksisi

Python sharhlari

Python o'zgaruvchilari

Python ma'lumotlar turlari


Python Strings
Python Booleans
Python Operators
Python Numbers

Python -ni ishga tushiring

Python sintaksisi

  • False
  • if 5 > 2: print("Five is greater than two!")
  • True
  • if 5 > 2: print("Five is greater than two!")
  • if 5 > 2: print("Five is greater than two!") if 5 > 2: print("Five is greater than two!") 

Python sharhlari

  • #This is a comment print("Hello, World!")
  • print("Hello, World!") #This is a comment
  • """ This is a comment written in more than just one line """ print("Hello, World!")

Python o'zgaruvchilari

Bir nechta qiymatlarni belgilang

Chiqish o'zgaruvchilari

Global o'zgaruvchilar

Python ma'lumotlar turlari

Python ma'lumotlar turlari

  • Example Data Type
  • x = "Hello World“ str
  • x = 20 int
  • x = 20.5 float
  • x = 1j complex
  • x = ["apple", "banana", "cherry"] list
  • x = ("apple", "banana", "cherry") tuple
  • x = range(6) range
  • x = {"name" : "John", "age" : 36} dict
  • x = {"apple", "banana", "cherry"} set
  • x = frozenset({"apple", "banana", "cherry"}) frozenset
  • x = True bool
  • x = b"Hello“ bytes
  • x = bytearray(5) bytearray
  • x = memoryview(bytes(5)) memoryview

Python Numbers

  • x = 1 # int y = 2.8 # float z = 1j # complex #float: a = float(x) #int: b = int(y) #complex: c = complex(x) print(a) print(b) print(c) print(type(a)) print(type(b)) print(type(c))

import random print(random.randrange(1, 10))

Python Strings


for x in "banana": print(x)
a = "Hello, World!" print(len(a))

String Format

  • age = 36 txt = "My name is John, and I am {}" print(txt.format(age))
  • ________________________________
  • qizil = 3 oq = 567 yashil = 49.95 myorder = “Menga {} ta qizil va {} ta oq va {} ta yashil gul kerak " print(myorder.format(qizil , oq, yashil ))

Python Booleans

  • print(10 > 9) print(10 == 9) print(10 < 9)
  • ________________________
  • a = 200 b = 33 if b > a: print("b is greater than a") else: print("b is not greater than a")

Python Operators

Python Operators


Yüklə 225,97 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2025
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin