Python/Introduction to python (Sololearn)

[Introduction to python] ~ List

의그 2023. 1. 27. 13:33

if ~:

print()

elif ~:

print()

else:

print()

print(not 1==1)

=> False

#your code goes here

BMI = float(input()) / float(input())**2

if BMI < 18.5:

print("Underweight")

elif BMI >= 18.5 and BMI < 25:

print("Normal")

elif BMI >= 25 and BMI < 30:

print("Overweight")

else:

print("Obesity")

리스트

print("abc" in str)

str 리스트에 "abc'가 있다면 True 반환.

for Loop

A for loop can be used to iterate over strings.

str = "testing for loops" count = 0 for x in str: if x == 't': count += 1 print(count) PY Click to run

=> 2

-

-

-

-

-