-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
57 lines (49 loc) · 1.38 KB
/
app.py
File metadata and controls
57 lines (49 loc) · 1.38 KB
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
print('hello world, my age is ',100)
#variables
name='tim'
print(name)
print(name+' is a good')
#data types
#string type
name='tim'
print(name)
#integer type
age=100
print(age)
print(name+' is a good',age)#concatenate
# we cant use + we have to use comma when concatenanting ths tring wityh the integer type
#strings in python
print('hi\n hello')
print('hi\'how about you')# to add a quote how u annt to see the text use /
print(name[2])#indexing
print(name[0:2])#slicing
print(name.upper())#upper case
print(name.islower())#lower case
print(name.upper().islower())#lower case
print(len(name))#length
print(name.index('i')) #index of the letter
print(name.replace('t','p'))#replace the letter
#numbers in python
print(2)
print(2.0987) #float type
print(-2.0987) #negative number
print(3+4.5) #addition
print(3*4+5) #multiplication
print(3*(4+5)) #brackets
print(10%3) #modulus
print(10/3) #division
print(10//3) #floor division
print(10**3) #exponential
print(abs(-10)) #absolute value
print(pow(3,2)) #power
print(max(4,6)) #maximum
print(min(4,6)) #minimum
print(round(3.2))#round
print(round(3.7))#round
number1=55
number2=str(number1)#type conversion
print(number2)
#input from user
name=input('enter your name: ') #input from user input
print('hello',name)
# always use comma with the string + int as they cant be concatenated