- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPythonExercise1
More file actions
Latest commit
39 lines (37 loc) · 671 Bytes
/
Copy pathPythonExercise1
File metadata and controls
39 lines (37 loc) · 671 Bytes
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
# Basic Numbers and Arithematics
>> 1
>> 1.0
>> 1+1
>> 3*5
>> 1/2
>> 2**4
>> 2+3*5+5
>> (2+3)*(6+9)
>> 8 % 2
# Variables
>> var=2
>> var
>> x=2,y=5
>> x+y
>> name_of_var = 12
>> # (Comments)
#String
>> 'singlequotes'
>> "Doublequotes"
>> " I can't go "
>> x= 'hello'
>> x
>> print
>> num =12
name='Arjun'
>> 'My number is {} and my name is {}'.format(num,name)
>> print('My number is {} and my name is {}'.format(num,name))
>> print('My number is {one} and my name is {two}'.format(one=num,two=name))
>> print('My number is {one} and my name is {two},more{one}'.format(one=num,two=name))
>> s='hello'
>> s[0]
>> s[4]
>> s='helloiamfine'
>> s[0:]
>> s[:3]
>> s[3:6]