Python 2.x Vs Python 3.x | Python Tutorials For Absolute Beginners In Hindi #91

preview_player
Показать описание


Best Hindi Videos For Learning Programming:

Follow Me On Social Media
Рекомендации по теме
Комментарии
Автор

print 7 / 5
print -7 / 5

'''
Output in Python 2.x
1
-2

print(7 / 5
)
print(-7 / 5)

Output in Python 3.x :
1.4
-1.4

SurajSingh-mfvz
Автор

print(type("This is a normal string"))
print(type(b"This is a string with b"))

Output of above print statements in Python 2: (Bytes is same as string)
< type 'str' >
< type 'str' >

Output of above print statements in Python 3: (Bytes and strings are different)
< type 'str' >
< type 'bytes' >

piyushhinduja
Автор

Harry bhaai .. python ka interview questions ki video chahiye.. urgent hai... Please

ramaisgod
Автор

How to think like a programmer?
#Harry

akashgupta
Автор

# python 2 code

# def greet(name):
# print "Hello, {0}!".format(name)
# print "What's your name?"
# name = raw_input()
# greet(name)

# python 3 code

def greet(name):
print(f"Hello {name}")
print ("What's your name?")
name = input()
greet(name)

anantluthra
Автор

Python 2 does not support formatted strings.

SurajSingh-mfvz
Автор

Python 2.7 :

for x in range(1, 11):
print x

Python 3.x:

for x in range(1, 11):
print(x)

RahulSharma-bojc
Автор

In python 2, giving global variable and control variable in for loop ; the same name, leads to problems which is solved in python 3

#Python 2
i = 1
print 'before: i =', i
print 'list ', [i for i in range(6)]
print 'after: i =', i


Output
before: i = 1
list : [0, 1, 2, 3, 4, 5]
after: i = 5

#Python 3
i = 1
print('before: i =', i)
print(list :', [i for i in range(6)])
print('after: i =', i)

Output
before: i = 1
list : [0, 1, 2, 3, 4, 5]
after: i = 1

jigarsiddhpura
Автор

Python 2:
a = raw_input('Enter a word:')

Output:
Enter a word:_

Python 3:
a = input('Enter a word:')

Output:
Enter a word:_

underscore("_") denotes the cursor position

ComradeWeredog
Автор

In python 2.7 :-
1. User input :-
raw_input("Press Enter to exit")
2. To print a statement :-
print" "

In python 3 :-
1. User input :-
input("")

2. To print a statement :-
print(" ")

MohitGanganA-
Автор

python 3 -
print 2+2
python 2 -
print(2+2)

megaempireminecraft
Автор

task:
python 2
x = 10
if x > 9:
print 'Yay! This works!'
else:
if x > 7:
print 'Wait, what are you doing?'
else:
if x > 3:
print 'Yep, you screwed this up.'
else:
print "You just can't get this right, can you?"

python 3
x = int(input("Enter a number "))

if (x > 9):
print("Yay! This works!")

elif (x > 7):
print("Wait, what are you doing?")

elif (x > 3):
print("Yep, you screwed this up.")

else:
print("You just can't get this right, can you?")

talhaali
Автор

Best of the best video series on Python... Than you for the efforts.
The only suggestion I can give is - Video ka number jo hai vo start me rakhe to sikhane vale bachhe samaj jayenge.. Unhe last me dekhana nahi samajh raha ;)

PratikSulpatil-ivev
Автор

print(type(b"hello world"))
in python 2.0
output:<type 'str'>
in python 3.0
output:
<type 'bytes'>

aasthahimthani
Автор

range function:

python 2.0:
print range(0, 10, 1)

python 3.0:
print(list(range(10)))

codingssprint
Автор

# Python 2 Code
x = 10
if x > 9:
print 'Yay! This works!'
else:
if x > 7:
print 'Wait, what are you doing?'
else:
if x > 3:
print 'Yep, you screwed this up.'
else:
print "You just can't get this right, can you?"

# Python 3 Code
x = 10
if x > 9:
print ('Yay! This works!')
else:
if x > 7:
print ('Wait, what are you doing?')
else:
if x > 3:
print ('Yep, you screwed this up.')
else:
print ("You just can't get this right, can you?")

udaygupta
Автор

Mai to jbse dekh rhi yhi version use ho rha
D:\Programmings\python>python --version
Python 3.8.1

harshitachaurasia
Автор

python 2- class Form(BaseForm):
__metaclass__ = FormType
pass
python 3- class Form(BaseForm, metaclass=FormType):
pass

fatehakhanpapri
Автор

thankyou bhai ye bat sirf tumne btai tumne jruri smjhi or koi b bnda is bat ko or is topic ko smjhana nahi chahta na btata kisi or ko. n i m pretty sure ye bat ach me muje help kregi aage. thnx bhai

kashishjain
Автор

Python 2x = "hello everyone"
Python 3x =("hello everyone ")

ankitakamthes