Montana Tech of The University of Montana
Computer Science Department

CSCI 135
Fundamentals of Computer Science I
Fall 2021



LAB ASSIGNMENT 3

In this assignment, you will get experience using for and while loops.


Pick Teams

You need to write a program for a user to enter in teams to be printed. The user will enter in the number of teams they want (using input, not command line) between 2 and 10. If the user enters a number that is not between 2 and 10 (inclusive) exit the program with the message "Try Again".

FAQs:

How do I get user input? The function input() can be used. Remember that input, whether from the command line or interactively, comes in as a string, so you will need to decide whether to convert it to an integer or use it as is. For example:
x = int(input("Please enter a number: "))
will get input from the user (and give them the instruction to "Please enter a number"), convert it to an integer, and store the result in the variable x.
x = input("Please enter a number: ")
will create a string variable instead.

How do add more to a string variable? This example would add a new line to the end of the existing myString variable.
myString += "\n"


There's a lot to this program. How do I get started? Read the problem carefully and write down what steps you need to do.
The first thing might be to just handle getting the user input and exiting the program if needed.
Next you might want to just print Team1 Team2.... on their own lines based on the input. Should you use a for loop or a while loop?
Then decided what wheich step to tackle next. Always be testing your code as you go writing small chunks at a time.


Grading The lab assignment is worth 30 points. You will be graded according to the following criteria:

Grade Item Password Points Earned
Program Compiles and Runs
4
Header Comment
4
Loop Comments
4
One Print Per Team
6
Output Format
4
Recieves and Prints Names Correctly
8



Submission. Submit your program PickTeams.py via Moodle under the Lab03: Lists dropbox. Be sure each submitted source file has the required header with your name, and a description of the program.

Page last updated: September 15, 2021