Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use this link to accept the assignment and create your repository for class05 on GitHub:  https://classroom.github.com/a/r0IrNdhL


After you accept the assignment and the repository and it exists in your GitHub clone the class05 repository into your working area on Rivanna. 

...

>>>  git clone git@github.com:PHYS1655S24PHYS1655Su24/class05-<userid>.git


 Navigate into that directory via usage of the 'cd' command.

...

→  Add, commit, and push your FlowControl.ipynb to GitHub and make sure it is updated there.  

2) Fun with strings. (if time remains- Prof. Group -make sure input.py is in classo5 repo and that you talk some about strings in the slides)

Copy over input.py to a file named string_fun.py. Make sure to update the header information at the top of the file.

In this program request an input string from the user (hint: use the input function).  Your program should:

  • Check how many words are in the string (use strip and split - check documentation for how to do it), and print info to the screen.
    • Count how many  characters are in the string, and print info to the screen.
    • print the first 2 characters to the screen.
    • print the last 2 characters to the screen.
  • Request an integer from the user (use input).  Check to make sure it is an integer.  Hint: use try/except (Google it if you need to) to make sure.  Input validation! 
  • Use a for loop (example in reading) to print the string to the screen the number of times of the integer that they input can count them.  It should look like this:

1 : this is my string

2 : this is my string

3 : this is my string

4 : this is my string

5 : this is my string

Include documentation/comments to string_fun.py and add, commit, and push it to your repository on GitHub . .