UNC has a long tradition of basketball. An important part of the tradition is when UNC scores 100 or more points at a game, you can get a free southern biscuit at Bojangles with your ticket.
comp110/exercises
directory create a directory named ex02_if_else
comp110/exercises/ex02_if_else
directory create a file named biscuits.py
input
function to ask the user “How many points did UNC score?” and store their response in a variable called score
of type str
.score
variable.numeric_score
of type int
to store the numeric representation of the score.
int
function to convert the score
string to an integer. Ex: int(score)
(documentation: https://docs.python.org/3/library/functions.html#int
).numeric_score
is greater than or equal to 100, print “biscuits!!”. Otherwise, print “no biscuits.”__author__
variable containg your PID in a str.python -m comp110.exercises.ex02_if_else.biscuits
Example program run A:
How many points did UNC score? 110
UNC scored 110 points!!
biscuits!
Example program run B:
How many points did UNC score? 99
UNC scored 99 points!!
no biscuits.
comp110/exercises/ex02_if_else
directory create a program named quadratic.py
input
and int
built-in functions to prompt the user for 3 integers – a
, b
, and c
https://en.wikipedia.org/wiki/Quadratic_formula
sqrt
function.
import math
at the top of your file.math.sqrt(4)
would resolve to 2.sqrt
function produces a float
, so your final answer should be one as well.4.0, 2.0
.4.0 repeated
.2 imaginary roots
.__author__
variable containg your PID in a str.Note: Creating intermediate variables may be helfpul!
Example program run with two real roots:
Enter coefficient 'a' 1
Enter coefficient 'b' -2
Enter coefficient 'c' -4
3.23606797749979, -1.2360679774997898
Example program run with repeated roots:
Enter coefficient 'a' 1
Enter coefficient 'b' -4
Enter coefficient 'c' 4
2.0 repeated
Example program run with imaginary roots:
Enter coefficient 'a' 1
Enter coefficient 'b' 2
Enter coefficient 'c' 3
2 imaginary roots.
Go ahead and delete any submission zips lingering around in your workspace from the previous exercise.
When you are ready to submit for grading, close out any open Python Debug Console terminals using the Trash Can and then open up a clean, new terminal.
python -m tools.submission comp110/exercises/ex02_if_else
This should produce a submission timestamped with the current date/time for uploading on Gradescope.