integer, multiple , input , python string, python list



#an integer assignment

counter = 100
miles = 1000.0
#a floating point

name = "Jhon"
#string

print(counter) = 100
print(miles) = 1000
print(name) = Jhon

#multiple assignment
counter,miles,name = 100, 1000.0, "john"
print(counter, miles, name) = 100 1000.0  john

#print ("My name is", name)

#input
names = input("Who are you?")
print (names)



#input
names = input("Who are you?")
print ("My name is", names)

#python string
str= "hello world"
print str =  hello world
print str[0] = h
print

#python string
str = "hello world!"
print (str)   =  hello world!
print (str[0]) = h
print (str[2:5]) = llo
print (str[2:]) =llo world
print (str * 2)= hello world!hello world!
print (str + "TEST") = hello world! TEST
print (str[0:5]) = hello
print (str, "TEST") = hello world! TEST


#python list
list1 = ["abcd", 768, 2.23, 'john', 70.2]
tinylist = [123, 'john']

print (list1)
print (list1[0])
print (list1[1:3])
print (list1[2:])
print(tinylist * 2)
print (list1 + tinylist )

Comments

Popular posts from this blog

WD&D (DNS)

kclothings.org

WDD-LO1-server