Программирование вложенных условий. Урок 1 Сопоставь код с его результатом:
Количество соединений: 4
number=int(input("Enter the value of number="))
if(number!=0):
if(number>0):
print("The number is positive")
else:
print("The number is negative")
else:
print("The number is equal to Zero")
number1=int(input("Enter the value for First number="))
number2=int(input("Enter the value for Second number="))
number3=int(input("Enter the value for Third number="))
if(number1<number2):
if(number1<number3):
print("The first number is smallest")
else:
print("The third number is smallest")
else:
if(number2<number3):
print("The second number is smallest")
else:
print("The third number is smallest")
age=20
marks=70
if(age>18):
if(marks>65):
print("you are selected for college")
age=20
gpa=1.1
if age>18:
if gpa>0.8:
print("Your age and GPA are both enough");
print("You have been selected for university")
else:
print("your gpa is not enough")
else:
print("your age is not enough")
Your age and GPA are both enough
You have been selected for university.
Enter the value of number=–90
The number is negative
Enter the value for First number=90
Enter the value for Second number=50
Enter the value for Third number=100
The second number is smallest
you are selected for college
Назад
Проверить