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

\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\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{center}

{\large {\bf   October 3, 2022, Python Basics  
}}
\end{center}
 
 

 
Log onto the Internet from a computer (not a telephone, unless you {\it really} have to) and go to the site \href{https://www.codabrainy.com/en/python-compiler/}{https://www.codabrainy.com/en/python-compiler/}.  This is a Python compilers. You will do the homework with it. 

\noindent
0. Type into the top of the code box of the code box of the compiler, which says ``main.py"" at the top, something like this, but with your name on it:

\noindent
\#October 3, 2022\\
\#John Smith\\
\#Some python for homework

This is just a ``comment'', writing in a computer program that explains what you are doing. 

For the next steps, you can write them all below what you've just written, gradually making the program longer. 

\noindent
1. First, try out   a short  program. Use CTRL-C and CTRL-V to copy a program into the code box of the compiler, which says ``main.py"" at the top.  Or, just write it out. Then use your mouse to click the biggest of the three triangle buttons, and see what output comes out in the other big box. 
\begin{verbatim}
y = 2+2
print(y)
\end{verbatim}

If you see ``4'' as output, it worked. 


\noindent
2.  Now do the same with this program.
\begin{verbatim}
print(``Hello World'')
\end{verbatim}

 Say what happens. 
 
 
\noindent
3. Combine the two ideas this way: 

\begin{verbatim}
a = 3233\\
b = 56\\
print(``3233/56 is '', a/b, ``.'')
\end{verbatim}
What comes out? 


\noindent
4.  Write your own code to divide one number by another and print out the result.  Write it here. 
\vspace*{72pt}


\newpage

\noindent
5.    Try this code: \\
c = 2/3\\
d = 1/2\\
wingnut = x*y\\
print (``2/3 times 1/2 is ``, wingnut, ``.'')\\
print (``2/3 times 1/2 is ``, wingnut, ``.$\backslash$n'')\\
 print (``2/3 times 1/2 is ``, wingnut, ``.$\backslash$n'')
 
 What does adding   $\backslash$n do?

\vspace*{72pt}


\noindent
6.   Multiply   356/781 by 999 and print the result. 

\noindent
7. Divide 327/1000 by  2/9 and print the result. 

\noindent
8.  Try the following code: \\
x = 3\\
y =2\\
z = x**y\\
print(" 3**2 equals  '', z, ``.$\backslash$n'')\\

\noindent
y = 5\\
 z = x**y\\
print("  Now z is   '', z, ``.$\backslash$n'')\\

What does the operator ** do? 

\noindent
9.  Try this code: 
\begin{verbatim}
x = "This is a sentence."\\
print(x)\\
print (5*x)
 \end{verbatim}

Now try that again, but instead of 5, write a bigger number. What happens? 
 
\end{document}
 