Python for absolute beginners – Part2

Get data from user and formatted print

input("Message")
print("Message")

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

      • 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:

WordPress.com Logo

You are commenting using your WordPress.com 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