diff --git a/bouns.py b/bouns.py new file mode 100644 index 0000000..323e23d --- /dev/null +++ b/bouns.py @@ -0,0 +1,8 @@ +print() +num = int(input("Enter Positive Integer:") ) +Total= 0 +for i in range(1, num + 1 ): + if i % 2 == 0: + Total += i + +print("The sum of even numbers between 1 and", num, "is",Total) \ No newline at end of file diff --git a/for_while_loop.py b/for_while_loop.py new file mode 100644 index 0000000..fd7ba8c --- /dev/null +++ b/for_while_loop.py @@ -0,0 +1,25 @@ +# for loop + +number_range = (45, 210) + +for num in range(45, 210): + + if num == 100: + continue + + elif num == 205: + break + + else: + print(num) + +print() + +# while loop + +question = "What is the product of 7 * 24 ? " + +while input(question) != "168": + print("Your answer is wrong, try again.") + +print("You answered this Question correctly.") \ No newline at end of file