-
Notifications
You must be signed in to change notification settings - Fork 6
/
introduction.py
82 lines (79 loc) · 2.13 KB
/
introduction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> #Q.1- Print anything you want on screen.
>>> print("hii my name is ashish and m learning well")
hii my name is ashish and m learning well
>>> x="hy my name is ashish and m learning well"
>>> x
'hy my name is ashish and m learning well'
>>> x ="hy my name is ashish"
>>> print(x)
hy my name is ashish
>>> print("%s"%("hy y name is ashish"))
hy y name is ashish
>>> #END
>>>
SyntaxError: invalid syntax
>>> >>> #Q.2- Join two strings using '+'.
>>> x="\"Acad\""
>>> y="\"View\""
>>> print(x+y)
"Acad""View"
>>> #without ""
>>> x="Acad"
>>> y="View"
>>> print(x+y)
AcadView
>>> #END
SyntaxError: invalid syntax
>>> >>> #Q.3- Take the input of 3 variables x, y and z . Print their values on screen
>>> x="rajat"
>>> y="ashish"
>>> z="yash"
>>> print(x,y,z)
rajat ashish yash
>>> #another
>>>
>>> x="1"
>>> y="2"
>>> z="3"
>>> print(x,y,z)
1 2 3
SyntaxError: invalid syntax
>>> >>> #Q.4- Print “Let’s get started” on screen.
>>> print(" \" Let’s get started \" ")
" Let’s get started "
>>> #another
>>> x=" \" Let’s get started \" "
>>> x
' " Let’s get started " '
>>> #another
>>>
>>> x=" \" Let’s get started \" "
>>> print(x)
" Let’s get started "
>>>
>>> #end
SyntaxError: invalid syntax
>>> >>> #Q.5- Print the following values using placeholders.
#s=”Acadview”
#course=”Python”
#fees=5000
>>>
>>> print(" s = \"%s\", \n course = \"%s\" , \n fees = \"%d\"" % ("python","acadview", 5000))
s = "python",
course = "acadview" ,
fees = "5000"
>>> #End
SyntaxError: invalid syntax
>>> >>> #Q.6- Let’s do some interesting exercise:
#name=”Tony Stark”
#salary=1000000
#print(‘%s’’%d’)%(____ ,____)
>>> name= "\"tony stark\""
>>> saliry= "\"100000\""
>>> print("%s,%s" % (name,saliry))
"tony stark","100000"
>>> #END