migrate to git.charlotte.sh

This commit is contained in:
Charlotte Croce 2025-04-19 23:42:08 -04:00
commit fbd588721e
412 changed files with 13750 additions and 0 deletions

View file

@ -0,0 +1,5 @@
number = int(input('Enter a two digit number: '))
# Print the two digits of the number seperated by a space
print((number // 10),(number % 10))

View file

@ -0,0 +1,7 @@
# Read an integer:
number = int(input('Enter a two digit number: '))
# Print the digits reversed
print(str(number % 10) + str(number // 10))

View file

@ -0,0 +1,7 @@
# Read an integer:
number = int(input('Enter a 3 digit number: '))
# Print the sum of the digits:
a = ((number // 100) + (number % 100 // 10) + (number % 10))
print(a)

View file

@ -0,0 +1,46 @@
def days_to_hours(days):
""" Converts days to hours
Arguments:
days (int): number of days as an integer
Return:
number of hours (int)
Assumptions:
days must be an int
"""
return days * 24
print('Days to hours:', days_to_hours(3))
hours = days_to_hours(2)
def days_to_minutes(days):
""" Converts days to minutes
Arguments:
days (int): number of days as an integer
Return:
number of minutes (int)
Assumptions:
days must be an int
"""
return days_to_hours(days) * 60
def days_to_seconds(days):
""" Converts days to seconds
Arguments:
days (int): number of days as an integer
Return:
number of seconds (int)
Assumptions:
days must be an int
"""
return days_to_minutes(days) * 60

View file

@ -0,0 +1,14 @@
def celsius_to_fahrenheit(temperature_in_celcius):
"""This function converts a number from Celcius to Fahrenheit
Arguments:
temperature_in_celcius (float): The remperature to convert
Returns:
float: The temperature in Fahrenheit
Assumptions:
Assumes that temperature_in_celcius is a float
"""
return (temperature_in_celcius * 1.8) + 32

View file

@ -0,0 +1,13 @@
from math import pi # This lets you refer to pi in your code
def volume_cone(radius, height):
"""Computes volume of a cone
:param radius: positive float
:param height: positive float
:return: volume of given cone
"""
return 1/3 * pi * (radius*radius) * height

View file

@ -0,0 +1,87 @@
"""
Author: Charlotte Croce
Class: CSI 160
Assignment: Week 3 Lab
Due Date: 2/3/25
Certification of Authenticity:
I certify that this is entirely my own work, except where I have given
fully-documented references to the work of others. I understand the definition
and consequences of plagiarism and acknowledge that the assessor of this
assignment may, for the purpose of assessing this assignment:
- Reproduce this assignment and provide a copy to another member of academic
- staff; and/or Communicate a copy of this assignment to a plagiarism checking
- service (which may then retain a copy of this assignment on its database for
- the purpose of future plagiarism checking)
"""
from math import pi
def fahrenheit_to_celcius(temperature_in_fahrenheit):
"""This function converts a number from Fahrenheit to Celcius
:param temperature_in_fahrenheit (float): The temperature to convert
:return (float): The temperature in Fahrenheit
Assumptions: temperature_in_fahrenheit is a float
"""
try:
return round(((temperature_in_fahrenheit - 32) * 5 / 9), 2)
except TypeError:
print("invalid input: input floats please")
return
celcius_temp = float(input("---\n1. temp in fahrenheit: "))
print("1. coverted to celcius:", fahrenheit_to_celcius(celcius_temp))
def cylinder_volume(radius, height):
"""Computes volume of a cylinder
:param radius: positive float
:param height: positive float
:return: volume of cylinder
Assumptions: inputs are floats
"""
try:
return round((pi * (radius*radius) * height), 2)
except TypeError:
print("invalid input: input floats please")
return
cylinder_radius = float(input("---\n2. cylinder radius: "))
cylinder_height = float(input("2. cylinder height: "))
print("2. cylinder volume:", cylinder_volume(cylinder_radius, cylinder_height))
def surface_area_rectangular_prism(length, width, height):
"""Computes surface area of a rectangular prism
:param length: positive float
:param width: positive float
:param height: positive float
:return: surface area of a rectangular prism
Assumptions: inputs are floats
"""
try:
return round((2 * ((length*width)+(length*height)+(width*height))), 2)
except TypeError:
print("invalid input: input floats please")
return
rectangular_prism_length = float(input("---\n3. rectangular prism length: "))
rectangular_prism_width = float(input("3. rectangular prism width: "))
rectangular_prism_height = float(input("3. rectangular prism height: "))
print("3. rectangular prism surface area:", surface_area_rectangular_prism(rectangular_prism_length,rectangular_prism_width,rectangular_prism_height))