-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyhton_2Print.py
More file actions
93 lines (66 loc) · 1.78 KB
/
Copy pathPyhton_2Print.py
File metadata and controls
93 lines (66 loc) · 1.78 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
"""
Important function in python programming which helps in displaying the output , this is used in Text,Numbers and Variables
"""
#Syntax
print("Simple and plain Text ")
print("I love Python")
print("Hello")
print(" ")
#Explaination of print with the help of variable
name = "Om Bacchuwar"
age = 21
print("Hello my name is ",name ," and i am ", age ,"years old")
print(name,age)
print(" ")
#without end parameter
print("Hello")
print("World")
print(" ")
#with end parameter
print("Hello", end=" ")
print("world")
print(" ")
print("Hello",end="! ")#another Example
print("World")
print(" ")
#Syntax is nothing but the rules to write the code , by which the we will not get any error in our code after following it
#Python has very simple and easy syntax as compared to other programming languages like C++,Javascript, C , etc.
"""
Simple points by which we can explain that python's syntax is more simple than other programming languages
1. LESS BOILERPLATE
Less lines of code is written in python as compared to other languages
for example : Printing Hello world
In python🐍
"""
print("Hello World")
print(" ")
"""
In C
#include<stdio.h>
int main()
{
printf("Hello World");
return 0;
}
2. DYNAMIC TYPING
Here we don't need to explicitly / declare the type of variable already before the code.
Datatype like Number , String , Characters, etc.
for example :Printing variable
In python🐍
"""
num = 10
print(num)
print(" ")
"""
In C
#include<stdio.h>
int main()
{
int num = 10; Here we have to specify the datatype that we are going to use as a variable.
printf(%d,"&num");
return 0;
}
3. No ';' / '{}'
No use of ; semicolon to end the statement
No use of {} curly braces to define the codeblock
"""