31 May 2019

We learned how to install PyCharm. we created our first project and a .py file to store our code. we ran our program in the PyCharm Terminal using the Play button (or Ctrl+Shift+F10). we saw how to get string from the user keyboard using the input command. we used int( ) and float( ) commands in order to change the input string into a number. we saw how to split a string using split( ). the split command creates a list. a list type is very similar to a string type except that each item in a list could be in any type. in contrary to a string, where each item is a character. however, commands such as len( ) and [ ] work the same. we saw the print command. and how to format a string using { }. finally, we saw how to write conditions: if, else, elif and how to use spaces to separate between if and else code

More topics covered:

  • if:  >  <  ==  !=  >=  <=  and  or
  • “a.b.c”.split(“.”) => [‘a’, ‘b’, ‘c’]
  • “a.b.c”.split( ) => [“a.b.c”]
  • print( “{ } + { } = { }”.format(x, y, x + y) )
  • print( “{:.2f} “.format(3.333) ) => 3.33
  • ‘a’ in [‘a’, ‘b’, ‘c’] ==> True

Links:

Leave a comment