[go: up one dir, main page]

0% found this document useful (0 votes)
6 views7 pages

Voiles Walsh Walters Lab Python 1

The document contains a series of Python lab problems completed by students Nicholas Voiles and Rylan Walsh for AERE 1610 in Spring 2025. Each problem includes code snippets that demonstrate various programming concepts such as conditional statements, mathematical calculations, and user input handling. The outputs of the code are also provided, showcasing the results of the executed programs.

Uploaded by

naveendeswal180
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views7 pages

Voiles Walsh Walters Lab Python 1

The document contains a series of Python lab problems completed by students Nicholas Voiles and Rylan Walsh for AERE 1610 in Spring 2025. Each problem includes code snippets that demonstrate various programming concepts such as conditional statements, mathematical calculations, and user input handling. The outputs of the code are also provided, showcasing the results of the executed programs.

Uploaded by

naveendeswal180
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Names of Present Group Members: Nicholas Voiles, Rylan Walsh

AERE 1610, Spring 2025 Lab # Python 1

Problem 1

#Rylan Walsh, Nicholas Voiles, Ayden Walters


i = int(input("Enter a number: ")) #get the input number
if i == 0: #if the number is zero
print("number is zero") #tell user its zero
elif i %2 == 2: #if the number is even
print ("number is even") #tell user is even
else: #if not 0 or even
print("number is odd") #tell user is odd

Output :

Enter a number: 0
number is zero

Enter a number: 1
number is odd

Enter a number: 4
number is odd
Names of Present Group Members: Nicholas Voiles, Rylan Walsh
AERE 1610, Spring 2025 Lab # Python 1

Problem 2

>>> x = 12345.6789
>>> print(x)

>>> print(f"{x:10.4f}")

>>> print(f"{x:2.2f}")

Output :

12345.6789

12345.6789

12345.68
Names of Present Group Members: Nicholas Voiles, Rylan Walsh
AERE 1610, Spring 2025 Lab # Python 1

Problem 3

#Rylan Walsh, Nicholas Voiles, Ayden Walters


import math #imports math to write the equation
x = int(input("Provide an integer: ")) #asks for x
t = int(input("\n Provide another integer: ")) #asks for t
z = (math.exp(x) * (9 * math.pi * t + 10 * math.cos(x))) / (math.sqrt(t) -
abs(math.sin(t))) #uses math to make the equation
print(z) #prints z

Output :

Provide an integer: 10

Provide another integer: 1


2762685.70931887
Names of Present Group Members: Nicholas Voiles, Rylan Walsh
AERE 1610, Spring 2025 Lab # Python 1

Problem 4

#Rylan Walsh, Nicholas Voiles, Ayden Walters


n = int(input('Please Enther a Number: ')) #asks for the input n
print(f'The n + nn + nnn = {n}{2*n}{3*n}')#prints the three numbers next to eachother

Output :

Please Enther a Number: 2


The n + nn + nnn = 246
Names of Present Group Members: Nicholas Voiles, Rylan Walsh
AERE 1610, Spring 2025 Lab # Python 1

Problem 5

#Rylan Walsh, Nicholas Voiles, Ayden Walters


import math #imports math to write the equation
print("Menu\n 1. Cylinder\n 2. Circle\n 3. Rectangle") #shows options
choice = int(input("Please chose one: ")) #requests a choice
print("\n") #line space
while choice != 1 and choice != 2 and choice != 3: #if choice isn't 1, 2, or 3
choice = int(input("Invalid choice. Please choose 1, 2, or 3: ")) #requests valid choice
print("\n") #line space
if choice == 1: #if choice 1
r = int(input("Enter the radius in in.: ")) #requests radius
h = int(input("Enter the height in in.: ")) #requests height
v = math.pi * r * r * h #calculates volume
print("The volume is: ", f"{v:.2f}", " in^3") #tells volume
elif choice == 2: #if choice 2
r = int(input("Enter the radius in in.: ")) #asks for radius
a = math.pi * r * r #calculates area
print("The area is : ", f"{a:.2f}", " in^2") #tells area
else: #if choice 3
b = int(input("Enter the base in in.: ")) #requests base
h = int(input("Enter the height in in.: ")) #requests height
a = b * h #calculates area
print("The area is : ", f"{a:.2f}", " in^2") #tells area

Output :

runfile('C:/Users/rwals/.spyder-py3/temp.py', wdir='C:/Users/rwals/.spyder-py3')
Menu
1. Cylinder
2. Circle
3. Rectangle
Please chose one: 1

Enter the radius in in.: 7


Enter the height in in.: 6
The volume is: 923.63 in^3

runfile
Names of Present Group Members: Nicholas Voiles, Rylan Walsh
AERE 1610, Spring 2025 Lab # Python 1

Menu
1. Cylinder
2. Circle
3. Rectangle
Please chose one: 2

Enter the radius in in.: 6


The area is : 113.10 in^2

runfile
Menu
1. Cylinder
2. Circle
3. Rectangle
Please chose one: 3

Enter the base in in.: 7


Enter the height in in.: 7
The area is : 49.00 in^2

runfile
Menu
1. Cylinder
2. Circle
3. Rectangle
Please chose one: 4

Invalid choice. Please choose 1, 2, or 3: 4

Invalid choice. Please choose 1, 2, or 3: 5

Invalid choice. Please choose 1, 2, or 3: 2

Enter the radius in in.: 3


The area is : 28.27 in^2
Names of Present Group Members: Nicholas Voiles, Rylan Walsh
AERE 1610, Spring 2025 Lab # Python 1

You might also like