There was an error while loading. Please reload this page.
1 parent 2bb3ce3 commit e29678dCopy full SHA for e29678d
labs/Topic04-flow/lab04.04-student.py
@@ -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