CSC111 Some programs to play with
D. Thiebaut (talk) 10:19, 26 January 2018 (EST)
Below are some programs to play with on the first day/week of classes.
age = 20 year = 2018 yearBorn = year - age print( "you are", age ) print( "you were born in", yearBorn ) # --------------------------------------------- name = "Alex" college = "Smith College" print( name, "goes to", college ) # --------------------------------------------- for name in [ "Lea Jones", "Julie Fleur", "Anu Vias" ]: print( name ) print( "———————" ) # --------------------------------------------- for name in [ "Lea Jones", "Julie Fleur", "Anu Vias" ]: print( name, len( name ) ) # --------------------------------------------- print( "hello" * 4 ) print( "-" * 10 ) greetings = “hello” dash = "-" print( greetings * 4 ) print( dash * 10 ) # --------------------------------------------- greetings = "hello" longGreetings = greeting * 4 print( greetings ) print( longGreetings ) # --------------------------------------------- for name in [ "Lea Jones", "Julie Fleur", "Anu Vias" ]: bar = len( name ) * "-" print( name ) print( bar ) # --------------------------------------------- print( "hello" * 4 ) print( "-" * 10 ) greetings = “hello” dash = "-" print( greetings * 4 ) print( dash * 10 ) # --------------------------------------------- greetings = "hello" longGreetings = greeting * 4 print( greetings ) print( longGreetings )