UrbanPro

Learn Python Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

X=4 Y=X+4 Y=INT(STR(Y)+'2') PRINT(Y)

Asked by Last Modified  

25 Answers

Learn Python

Follow 0
Answer

Please enter your answer

Expert Programmer

82
Comments

Here is how it works: 1. X takes the value of 4 2. Y takes the value of 8 ( Y=X+4 ) 3a. str(Y) is evaluated as '8' 3b. next, str(Y)+'2' is evaluated - this gives us '82' 3c. next, INT('82') gets evaluated - which returns 82 and assigns it to Y. 4. No wonder 82 is printed.
Comments

82
Comments

22 Years Experienced Python Coding Computer Science ICT AI Java Maths Gurugram Tuitions Classes 6-12

This will print 82 and the for the reason, please have a look at the answer by Rajaram as it is well explained
Comments

82
Comments

Software Programmer

82
Comments

Advance C-Embedded

82
Comments

Tutor

INT, STR and PRINT have to be in lower case, else nothing is going to work. Python needs all functions to be defined in lower case. Then the answer would be 82 as everybody else has pointed out.
Comments

10
Comments

Tutor

Hello Annu, Please find below for the detailed explanation X=4 print 'X:', X, type(X) Y=X+4 print 'Y:', Y, type(Y) print 'str(Y)---', str(Y), type(str(Y)) print "str(Y)+'2'---", str(Y)+'2', type(str(Y)+'2') print "int(str(Y)+'2') ======", int(str(Y)+'2'), type(int(str(Y)+'2')) Y=int(str(Y)+'2') print...
read more
Hello Annu, Please find below for the detailed explanation X=4 print 'X:', X, type(X) Y=X+4 print 'Y:', Y, type(Y) print 'str(Y)---', str(Y), type(str(Y)) print "str(Y)+'2'---", str(Y)+'2', type(str(Y)+'2') print "int(str(Y)+'2') ======", int(str(Y)+'2'), type(int(str(Y)+'2')) Y=int(str(Y)+'2') print type(Y) ======================================== python .\sample-exp.py X: 4 type 'int' Y: 8 type 'int' str(Y)--- 8 type 'str' str(Y)+'2'--- 82 type 'str' int(str(Y)+'2') ====== 82 type 'int' type 'int' PS F:\Python ====================================================== Point-1: Initially both the variables X,Y are integers Point-2: At step-3 you converted variable 'Y' to string and concatenated('+') with '2' which resulted '82', a string This string '82' was again converted to int by the python int function The result is a integer value 82 for the variable 'Y' point-3: At step-4 you printed Y value which will be an integer output. You can use type() function to check, which class the variable belongs to. read less
Comments

View 23 more Answers

Related Questions

Is it possible to learn Python without any coaching class?
Certainly it is possible. What is required is some dedicated time, self-discipline and the willingness to learn by trial and error.
Neetu
0 0
7

is there an best online exam simulator for PCAP 31-02 python exam ?

yes, this will work Python exam in cisco net grade, it 's free and help in practice and if you clear this exam, you will get 50% off PCAP 31-02 exam coupon on your registered email id.
Rajgun
0 0
5
Between Java and Python, which one is better to learn first and why?
Both the development programs come with their strong suits. While Java allows you to enjoy the cross-platform support, Python helps you execute on at least ten different operating systems. It would help...
Priyanka
0 0
5
How can I easily learn Python?
UrbanPro does not allow naming a website in answer so I have to write in this way. 'sololearnDOTcom/Course/python' is the website you can follow for easily learning python3. Its like playing a game over there.
Aditi
0 0
6
What are the best learning sites for Python?
w3school, toturialpoint, leetcode is best for practice,CodeCademy, Udemy,Coursera
Apoorva
1 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Python is a popular programming language. It was created by Guidovan Rossum, and released in 1991.
Python is a popular programming language. It was created by Guidovan Rossum, and released in 1991. It is used for: web development (server-side), software development, mathematics, system scripting. What...

Python breaks into the top three programming languages in the Tiobe Index for the first time.
Python breaks into the top three programming languages in the Tiobe Index for the first time. The popularity of Python shows no sign of waning, with the programming language entering the top three in...

Why Do People Choose Python?
Lot of programming languages are available in the market today, but why do people choose python over them? What made it different from other scirpting languages. So factors made it unique, as below: Software...

Decorator in Python - Simplified
By definition, a decorator is a function that takes another function andextends(/decorates) the behaviour of the latter function without explicitly modifying it.Let see how we can apply decorators for...

Python : functional programming characteristics
Functions are first class (objects). That is, everything you can do with "data" can be done with functions themselves (such as passing a function to another function). Recursion is used as a primary...

Recommended Articles

Python is one of the most popular programming languages in the world. It is general-purpose, object oriented, high-level programming language used in a number of programming fields. Python is a great programming language to learn as it will introduce you to the world of programming. If you are from the technical background...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Looking for Python Training classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Python Training Classes?

The best tutors for Python Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Python Training with the Best Tutors

The best Tutors for Python Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more