Python for absolute beginners – Part2

Get data from user and formatted print


by this code, you ask the users to input some data
now let’s improve it.

      • Some converting functions

      • int(x)
      • float(x)
      • bool(x)
      • type(x)
      • len(x)  len(“string”) ==> 6
      • x.upper()   hi ==> HI
      • x.lower()  Hello ==> hello


    • string.find(char)
      q = “Hello”
      q.find(“e”) ==> 1
    • x.replace(a,b)
      q = “Hello There”
      q.replace(“There”, “My friend”)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s