\documentclass[12pt,reqno,twoside,usenames,dvipsnames]{amsart}

\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{mathabx}
\usepackage{hyperref}
\usepackage{verbatim}
\hypersetup{breaklinks=true,
pagecolor=white,
colorlinks=true,
linkcolor= blue,
hyperfootnotes= true,
urlcolor=blue
}
\urlstyle{rm}

 

\newcommand{\margincomment}[1]
  {\mbox{}\marginpar{\tiny\hspace{0pt}#1}}

\newcommand{\comments}[1]{}
\renewcommand{\baselinestretch}{1.2}
 
 \parindent 24pt
 \parskip 10pt
\reversemarginpar
%\topmargin -1in
 \oddsidemargin -.5in \evensidemargin -.5in
%\textheight 10in
 \textwidth 7in


\begin{document}
% \begin{Huge}
\noindent
Eric Rasmusen\\
October 31, 2022
\begin{center}

{\large {\bf  Handout:  Basic Python Commands
}}
\end{center}
This illustrates some basic Python commands. Try printing them into Codabrainy one line at a time (or copy and paste them one at a time). If you do it one at a time, you can see how it works better than if you cut and paste it all at once. For each line, guess what will happen, before you press the triangle to run the program. 
\begin{verbatim}
print ("Hello World") #This is the basic print command. Quotes show text, not variable. 

print (3*"Hello World")

print (3*"Hello World\n")

#What does \n do? 

print ("_________________________________\n")
dog = 4
print (dog)
print("dog")
print ("The value of the variable dog is", dog)
print("If you print '3*dog' you get", 3*dog)

#This is a comment. It doesn't do anything except explain.   

print("If you print ' 2**dog' you get 2 to the dogth power, which is", 2**dog, "\n")

print("Print 'dog**(1/2)' and you get the square root of dog, which is",  dog**(1/2), "\n")

#You can go back and change dog to 400 and the numbers will  come out differently. 

print ("_________________________________\n")
doglist = [120,10 ,40,7]  #doglist is a list, not just one number

print("doglist is", doglist, "\n")

print("The list doglist has 4  items, at positions 0,1,2,and 3."   "\n")

print("The first item in doglist is doglist[0], which is", doglist[0], ". \n")

for item in  range(0,4):
  print("Item", item, "in doglist is", doglist[item]  )
  
print ("_________________________________\n")
  
end = 9
  
for item in  range(0,end):
  print("This is line number", item )
  
#Try making end bigger and bigger

print ("_________________________________\n")

for item in range(0,end):
  print("The next square is", item*item)
  
print ("_________________________________\n")
#We can do fancy equations too. 

x = 1

y =  1000 + (3*x +34)/(x**2 -5)

print("If x equals", x, "then since y = (3*x +34)/(x**2 -5),\n y equals", y)

print ("This  is the end. _________________________________\n")
\end{verbatim}

 \end{document}
