Academic Research in Educational Sciences
VOLUME 2 | ISSUE 12 | 2021
ISSN: 2181-1385
Scientific Journal Impact Factor (SJIF) 2021: 5.723
Directory Indexing of International Research Journals-CiteFactor 2020-21: 0.89
DOI: 10.24412/2181-1385-2021-12-1271-1275
Google Scholar
Scientific Library of Uzbekistan
Academic Research, Uzbekistan 1274 www.ares.uz
-
Parametrli takrorlanishlarni qadamlar
orqali boshqarish
for i in range(1,100):
if i % 2==0:
print(i, end=" ")
=>
for i in range(2,100,2):
print(i, end=" ")
Metodni qo’llanilishiga misol:
Quyidagi dastur tinglovchilarga tarqatiladi. Ular
harbir alamash tirishni kod
ustiga yozib borishadi. Belgilangan vaqt tugaganida almashtirislar soni so’raladi.
print("n gacha bo'lgan natural sonlar orasida k raqami necha
marta uchrashini
aniqlovchi dastur ")
print("n=", end="")
n=int(input())
print("k=", end="")
k=input()
s=''
p=0
for i in range(1,n+1):
s=s+str(i)
for i in range(0,len(s)):
if s[i]==k:
p+=1
print(p,"marta uchraydi")
Tinglovchilar quyidagicha o’zgartirishlarni kiritishlari mumkin:
Dostları ilə paylaş: