DEV Community

Umid2008
Umid2008

Posted on • Edited on

Integer and String(Python)

ornatilgam ma'lumotlar turlari

dasturlashda ma'lumot turlari muhim tushunchadir.

ozgaruvchilar har hil turdagi ma'lumotlarni saqlashi munkin va har xil bajarish munkin.

pyton dasturlash tilida quydagi malumot mavjud

text type - String

umeric tiypes - integer, float, complex

sequnce types - list, tipe, range

mapping type - dict

boolen tupe - booL

binary types - butes, butearriy, memoryview

none type - Nonetype

Misol uchun

x = "hello world" #-- #String

x = 20 -- int

x = 20.5 -- float

x = 1j -- complex

x = ["aplle" "banan" "cherry"] -- list

x = ("aplle" "banan" "cherry") -- tuple

x = range(6) -- range

x = {"Name", : "John","Age" : 36} -- dict

x = {"Apple", " banana", "cherry"} -- set

x = frozenset({"apple", "banna", "cherry",})

x = true

= b"hello" -- bytes

x = bytearray(5) -- bytearray

x = memoryview(bytes(5)) -- memoryview

x = None -- nonetype

string mashq!

x = "hello world"

display x:

print(x)

display the data type of x:

int ga mashq:

print(type(x))

int ga mashq!

x = 20

= 25

c = x + y

z = c + x

e = z + c

display x:

print(e)

display the data type of x:

print(type(e))

float ga mash!

x = 20.5

display x:

print (x)

display the type of x:

print

complex ga mashq!

x = 1j

dsplay x:

print(x)

display the of x:

print(type(x))

x = 9 + 8j

y = 10 + 4.5j

print(type(x))

print(type(y))

print(type(z))

print(type(x)

print(type(y)

print(type(z)

list ga mashq!

x = ["apple","banana","cherry"]

display x:

print(x[2])

display the data of x:

print(type(x))

my_list = ["jessa", "kelly", 20,35.75]

print(my_list)

print(type(my_list))

type ga mashq!

x = ("apple", "banana", "cherry")

displaay x:

print(x)

displayga the data type of x:

print(type(x))

my_tuple = (11, 24, 56, 88, 78)

print(my_tuple[2:5])

range ga mashq!

x = range(6)

display x:

print(x)

display the data type of x:

print(type(x))

Top comments (0)