Skip to content

SJ-Coding-Club/January-2021-Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Challenge 01

This one is designed to be more beginner friendly. If you're confused on how to do something, just ask me!

You can earn points by submitting solutions for any of the problems, so don't worry about finishing all of them if you can't yet.

Please create a separate file for each problem you submit to Google Classroom.

Leaderboard

Contestant Problem 00 Problem 01 Problem 02 Problem 03 Problem 04
Jack Donofrio N/A N/A N/A N/A N/A
Jon Jazwinski 1/1 2/2 N/A N/A N/A
Samir Rajani 1/1 2/2 3/3 4/4 4/5

Problem 00

Write a program that prints "My first submission!" to standard output.

Problem 01

Write a program that prints "Hello, {name}!" where {name} is your name.

  • Example: "Hello, Jack!"

Problem 02

Write a program that calculates the volume of a cone with a radius of 5 and a height of 9.

Problem 03

Write a program that converts 40 degrees Celsius to degrees Fahrenheit.

Hint F = C * 9/5 + 32

Problem 04

Write a program that computes the roots of x2 + 16x + 52 = 0.

Hint 1 Two rational roots exist.
Hint 2 The quadratic equation might help
Hint 3 https://imgur.com/pjyy2l6

Solutions

problem00.py

print("My first submission!")

problem01.py

Suitable:

print("Hello, Jack!")

But this is better:

name = "Jack"
print(f"Hello, {name}!")

problem02.py

PI = 3.14159
radius = 5
height = 9
volume = 1 / 3 * radius * radius * height * PI
print(volume)

or

import math
radius = 5
height = 9
volume = 1 / 3 * pow(radius, 2) * height * math.pi
print(f"volume = {volume}")

problem03.py

c = 40
f = c * 9/5 + 32
print(f"{c} degrees Celsius is {f} degrees Fahrenheit")

problem04.py

import math
# x^2 + 16x + 52 = 0
# a^2 + bx + c form
a = 1
b = 16
c = 52
root_1 = (-b + math.sqrt(b*b - 4*a*c)) / (2*a)
root_2 = (-b - math.sqrt(b*b - 4*a*c)) / (2*a)
print(root_1, root_2)

Alternatively

import math
a = 1
b = 16
c = 52
discriminant = b*b - 4*a*c
root_1 = (-b + math.sqrt(discriminant)) / (2*a)
root_2 = (-b - math.sqrt(discriminant)) / (2*a)
print(root_1,root_2)

About

SJHS Coding Club January 2021 Challenge Problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published