-
-
Save dmitryTsatsarin/8dbfa0f497a41c7631df9868281ddf2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
#Задание 1 | |
#Даны числа a и b (a < b). Выведите сумму всех натуральных чисел от a до b (включительно). | |
while True: | |
print("Условие: a < b") | |
a = int(input("Введите число а: ")) | |
b = int(input("Введите число b: ")) | |
if a < b: | |
s = 0 | |
print("a < b числа удовлетворяют! Продолжаем:") | |
for x in range(a, b+1): | |
print("x = ", x) | |
s += x | |
print("s = ", s) | |
else: | |
print("a > b числа введены неверно! Попробуйте снова: ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment