Skip to content

Instantly share code, notes, and snippets.

@AnapalOne
Created May 12, 2025 19:35
Show Gist options
  • Save AnapalOne/79be1e61eed6b58c7a63992cb157d1b0 to your computer and use it in GitHub Desktop.
Save AnapalOne/79be1e61eed6b58c7a63992cb157d1b0 to your computer and use it in GitHub Desktop.
Python Cheat Sheets (Loops)
# 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