Repository navigation
Expand file tree
/
Copy pathFirstProgram.py
More file actions
123 lines (88 loc) · 2.02 KB
/
Copy pathFirstProgram.py
File metadata and controls
123 lines (88 loc) · 2.02 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
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
# Output in Python:
print("Hello World")
print("This is my first progra in python")
print("my name is M.Hilal.", "My age is 20.", " I am Software Engineer.")
print(20)
print(20+30)
# Variables in Python:
Name = "M.Hilal"
Age = 20
Address = "Mardan"
Age1 = Age
RollNo = 72.22
Old = False
A = None
print(Name)
print(Age)
print(Address)
print("My name is :", Name)
print("My age is :", Age)
print("My address is :" , Address)
print(Age1)
print(type(Name))
print(type(Age))
print(type(RollNo))
print(type(Old))
print(type(A))
a = 10
b = 62
sum = a + b
print("The sum of two numbers is :",sum)
"""Multi line comments method use three double quotes"""
# 1.Arthmetic Operators:
a = 10
b = 62
sum = a + b
sum = a - b
sum = a * b
sum = a / b
sum = a % b # mean to find out the remainder of two or more numbers
sum = a ** b # mean to find out the power of two or more numbers
print("The sum of two numbers is :",sum)
# 2.Relational Operators:
a = 10
b = 62
print(a == b)
print(a != b)
print(a > b)
print(a < b)
print(a >= b)
print(a <= b)
# 3.Assignment Operators:
num = 62
num = num + 10
num += 10
num = num - 10
num -= 10
num /= 10
num *= 10
num %= 10
num **= 10
print(num)
# 4.Logical Operators:
a = 10
b = 20
print(not False)
print(not True)
a = True
b = False
print("AND operator :", a and b)
print("OR operator :", a or b)
# Input in Python:
name =input("Enter your name : ")
input1 = input("Enter your age :")
print("wellcome", name)
print("Your age is:", input1)
name = str(input("Enter your nme :"))
age = int(input("Enter your age :"))
marks = float(input(("Enter your marks :")))
print("Your name is :", name)
print("Your age is :", age)
print("Your marks are :", marks)
# Question:
val1 = int(input("enter your first number :"))
val2 = int(input("ENter your sencond number :"))
print("The fist value is:", val1)
print("The second Value is :", val2)
sum = val1 + val2
print("The sum of these values is:", sum)