Created
May 12, 2025 19:35
-
-
Save AnapalOne/79be1e61eed6b58c7a63992cb157d1b0 to your computer and use it in GitHub Desktop.
Python Cheat Sheets (Loops)
This file contains hidden or 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
# For the CS ALA Python Cheat Sheets. | |
# Code is in the public domain, do whatever you want with it. | |
# | |
# Andrei Embarque <andreijosee@zoho.com> | |
print("This program will accept 10 numbers and will display the sum and product.\n") | |
i = 0 | |
sum = 0 | |
product = 1 | |
while i < 10: | |
# for i in range(0,11): | |
num = int(input("Input a number: ")) | |
sum = sum + num | |
product = product * num | |
i = i + 1 | |
print("\nThe sum of all numbers are:",sum,"\nThe product of all numbers are:",product) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment