Skip to content

Commit cc389ca

Browse files
committed
Add comments and refactor old scripts
1 parent 0929dab commit cc389ca

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

Diff for: area_calculator.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
"""This program will prompt the user to select a shape,
2-
then calculate the area of that shape and then
3-
print the area of that shape to the user"""
1+
# This program will prompt the user to select a shape,
2+
# then calculate the area of that shape and then
3+
# print the area of that shape to the user
44

55
print "***Calculator is starting***"
66

Diff for: calendar.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
"""a basic calendar that the user will be able to interact with from the command line. The user should be able to choose to:
2-
3-
View the calendar
4-
Add an event to the calendar
5-
Update an existing event
6-
Delete an existing event
7-
The program should behave in the following way:
8-
9-
Print a welcome message to the user
10-
Prompt the user to view, add, update, or delete an event on the calendar
11-
Depending on the user's input: view, add, update, or delete an event on the calendar
12-
The program should never terminate unless the user decides to exit"""
1+
# A basic calendar that the user will be able to interact with from the command line. The user should be able to choose to:
2+
#
3+
# View the calendar
4+
# Add an event to the calendar
5+
# Update an existing event
6+
# Delete an existing event
7+
# The program should behave in the following way:
8+
#
9+
# Print a welcome message to the user
10+
# Prompt the user to view, add, update, or delete an event on the calendar
11+
# Depending on the user's input: view, add, update, or delete an event on the calendar
12+
# The program should never terminate unless the user decides to exit
1313

1414
from time import sleep, strftime
1515

@@ -20,7 +20,7 @@
2020
def welcome():
2121
print "Welcome " + name + "."
2222
print "The calendar is opening..."
23-
sleep(1)
23+
sleep(1) #Adds a second before printing the next line.
2424
print "Today is: " + strftime("%A %B %d, %Y")
2525
print "The time is: " + strftime("%H %m %S")
2626
print "What would you like to do?"

Diff for: divisor.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
num = input()
2-
count = 0
3-
for i in range(1, num):
4-
if num % i == 0:
5-
count += i
6-
print count
1+
#A script that takes a number and returns a list of its divisors
2+
3+
def div():
4+
num = input("Enter a number: ")
5+
list = []
6+
for i in range(1, num):
7+
if num % i == 0:
8+
list.append(i)
9+
print list
10+
11+
div()

0 commit comments

Comments
 (0)