Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can You Make Sense of this Ugly Python Script? #5

Open
cmurray3 opened this issue Jan 25, 2024 · 0 comments
Open

Can You Make Sense of this Ugly Python Script? #5

cmurray3 opened this issue Jan 25, 2024 · 0 comments

Comments

@cmurray3
Copy link
Contributor

cmurray3 commented Jan 25, 2024

This course requires knowledge of the Python programming language. If you don't know what output the code below produces, you will likely struggle in this class. (You should also know how to run this code).

import numpy as np

(y, z) = ('banana', 37)
print(z)

def foo(x=3):
	x += 1
	return x
	
def bar():
	z = 9
	y = 'orange'
	return y[-1]
	
z = foo(31)
print(z, y)

something = bar()
print(f'This is {something} I wrote')

w = [1]
while len(w) < 5:
	w.append(sum(w))
print(w)
	
q = {'lion': True, 'tiger': True, 'apple': False}
for i in q:
	print(i)
	
u = np.array(w)
print(u[-1])

s = set([9, 9, 9])
print(s)

If you have not programmed in Python before, you are encouraged to drop this course and take IE 555 in the fall semester.

@cmurray3 cmurray3 pinned this issue Jan 25, 2024
@cmurray3 cmurray3 unpinned this issue Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant