FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-zero-to-hero/firstprogram.py at main · Tks-Devops/python-zero-to-hero · GitHub
Tks-Devops
/
python-zero-to-hero
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
3
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-zero-to-hero
/
firstprogram.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
132 lines (116 loc) · 2.58 KB
Breadcrumbs
python-zero-to-hero
/
firstprogram.py
Copy path
File metadata and controls
132 lines (116 loc) · 2.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
'''print("hello world")
print("tulasi is my name")
print("am from odisha")
print("this is my first programme","hello world")
print(23)
print(23+56)
#variables
name = "tulasi"
age =29
price=25.99
age2=age
print("name")
print( name )
print("my name is :",name)
print('my age is :',age)
print('my age is :',age2)
#rule of identifiers
print(type(name))
print(type(age))
print(type(price))
#data types
age =23
old = False
a = None
print(type(old))
print(type(a))
#key words (reserved words)
# print sum
a = 2
b = 5
sum =a+b
diff=a-b
print(sum)
print(diff)
""" comment for multiline using 3 comas """
#arithmetic operators
a=8
b=6
print(a+b)
print(a-b)
print(a*b)
print(a/b)
print(a%b) #reminder modulo operator
print(a ** b) #a^b(a to the power) power opertor
#relational / comparison operator
a=50
b=20
print(a==b)#False
print(a!=b)#true (a not equal to b)
print(a>=b)#true
print(a<=b)#false
#assignment operatr
num = 10
num = num +10 #10+10
num+=10
num-=10
num*=10
num/=10
num%=5
num**=10
print("num :", num)
#logical operator
print(not False)
print(not True)
a=50
b=60
print(not(a<b))
val1 = True
val2 = True
print("ans operator:",val1 and val2)# and operator work for both value will true result will true
print("Or operator:" , (a==b) or (a>b))
#type conversion(ex-int value converse to float )
# basically conversion are two type 1.type conversion and type casting
#1.type conversion
a=2
b=4.25
sum = a+b
print (sum)# auto conversion
# type casting- it is basically in this conversion manually need to perform
a="2"
b=1.25
print(a+b)
a = float("2")
b=4.25
print(a+b)
print(type(a))
a=3.14
a=str(a)
print(type(a))'''
#input function
'''input("where are you from :")
name=input("enter your name:")
print("welcome", name)#input only take as string if we want to print no then use type casting method
name = input("enter name :")
age =input ("enter age :")
marks = float (input("enter marks :"))
print("welcome",name)
print("age=",age)
print("marks=",marks) '''
#write a programme to input 2 number & print their sum
'''a=int(input("type 1st no :"))
b=int(input("type 2nd no :"))
print ("sum of 2 nos :" , a+b)'''
#wap to input side of a square & print its area
'''side = float(input("enter squre side :"))
print ("area :" , side * side)'''
#wap to input 2 floating point numbers & print their average.
'''a=float(input("enter u r 1st no :"))
b=float(input("enter u r 2st no :"))
print("avg :" , a+b/2)'''
#wap to input 2 it numbers , a and b.
#print true if a is greater then or equal to b . if not print false .
''''a= int(input("enter 1st int no : "))
b= int(input("enter 2st int no : "))
print("true/false:",a>=b)'''
#
Back
|
FazBrowse Home
|
New Git URL