python 세션 day-t payilagam for 루프 및 if 조건
for 루프:
for 루프는 시퀀스(목록, 튜플, 사전, 집합 또는 문자열)를 반복하는 데 사용됩니다.
구문:
시퀀스의 변수
예:
txt = '1234' for num in txt: print(num,end=' ') output: 1 2 3 4
조건:
If 문은 표현식을 확인하여 조건이 충족되는지 확인하고 얻은 출력을 기반으로 값을 반환하는 방식으로 작동합니다.
syntax: if condition: if condition is True else: if condition is False
예
x=20 if x>=20: print(x is within 20) else : print(x is above the limit) output: x is within 20
txt = '12a4' for num in txt: if num>='0' and num<='9': print(num,end=' ') else: print('Not Decimal',end=' ') Output: 1 2 Not Decimal 4 above code is the example of combines if and for.
name = input("이름을 입력해주세요: ")
인쇄(이름)
이름의 알파벳:
print(알파벳, end='*')
출력:
R*A*J*A
코드는 모든 색인을 각각 확인하고 출력합니다.
name1 = input("Enter the first name: ") name2 = input("Enter the second name: ") name3 = input("Enter the third name: ") name4 = input("Enter the fourth name: ") name = [name1, name2, name3, name4] for letter in name: if letter[0]=='G': print(letter) else: continue for alphabet in name: if alphabet[-1]=='a': print(alphabet) else: continue for alpha in name: for i in alpha: if i==' ': print(alpha) else: continue for character in name: if len(character)>9: print(character) else: continue output: Enter the first name: Guhanraja Enter the second name: Lakshmi Pritha Enter the third name: Guru Prasanna Enter the fourth name: Varatharajan Guhanraja Guru Prasanna Guhanraja Lakshmi Pritha Guru Prasanna Lakshmi Pritha Guru Prasanna Lakshmi Pritha Guru Prasanna Varatharajan
위 내용은 python 세션 day-t payilagam for 루프 및 if 조건의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Fiddlerevery Where를 사용할 때 Man-in-the-Middle Reading에 Fiddlereverywhere를 사용할 때 감지되는 방법 ...

Linux 터미널에서 Python 사용 ...

10 시간 이내에 컴퓨터 초보자 프로그래밍 기본 사항을 가르치는 방법은 무엇입니까? 컴퓨터 초보자에게 프로그래밍 지식을 가르치는 데 10 시간 밖에 걸리지 않는다면 무엇을 가르치기로 선택 하시겠습니까?

Pythonasyncio에 대해 ...

Investing.com의 크롤링 전략 이해 많은 사람들이 종종 Investing.com (https://cn.investing.com/news/latest-news)에서 뉴스 데이터를 크롤링하려고합니다.

Python 3.6에 피클 파일 로딩 3.6 환경 오류 : ModulenotFounderRor : nomodulename ...

SCAPY 크롤러를 사용할 때 파이프 라인 파일을 작성할 수없는 이유에 대한 논의 지속적인 데이터 저장을 위해 SCAPY 크롤러를 사용할 때 파이프 라인 파일이 발생할 수 있습니다 ...
