Python Session 2a

From OpenCircuits
Jump to navigation Jump to search

Ready to try.


For this assignment we have the following goals:

  • Learning more about printing
  • Learn just a bit about Lists
  • Learning about adding.

I could not find good links on the web for this ( I will keep looking ) so I will write a bit. Remember to try the examples.

A Bit of Coding for You[edit]

Lets see if you can write some code using the topics we have covered so far. Put your code in a file where you can fine it later.

Adding Lists[edit]

  • Make a list of boys names ( 3 to 5 names should do ), print it.
  • Make a list of girls name ( 3 to 5 names should do ), print it.
  • Add the lists together ( in a variable ) and print the longer list.
  • Does it matter if the two list are the same or different lengths?

Printing Letters[edit]

  • Make a string ( in a variable ) with the letters A to Z.
  • Use range( 26 ) to make a loop to print the letters one on a line, A to Z
  • What happens if you use range( 25 )
  • What happens if you use range( 30 )