Skip to content

Commit e29678d

Browse files
committed
Added Students.py
1 parent 2bb3ce3 commit e29678d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# A Program that reads in students
2+
# until the user enters a blank
3+
# and then prints them all out again
4+
5+
students = []
6+
7+
firstname = input("enter firstname (blank to quit): ").strip()
8+
while firstname != "":
9+
student = {}
10+
student["firstname"] = firstname
11+
lastname = input("enter lastname: ").strip()
12+
student["lastname"] = lastname
13+
students.append(student)
14+
# next student
15+
firstname = input("enter firstname of next (blank to quit): ").strip()
16+
17+
print("here are the students you entered:")
18+
for currentStudent in students:
19+
print("{}{}".format(currentStudent["firstname"],
20+
currentStudent["lastname"]))
21+
22+

0 commit comments

Comments
 (0)