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

I am working in a nontechnical field and i want to  switch this job and work in a technical field but I am not able to decide where to start. I want to learn, but what in Python?

I can help you make a blasting entry in technical profile. You can learn Informatica+Oracle and one real time project with me. It should be enough for your future growth.
Raksha
What is Python primarily used for?
Python is primarily used for the following:Python libraries are used in Machine Learning, Deep Learning, Data Science, Artificial Intelligence fields.Python frameworks such as Django and Tkinter are used...
Raja
0 0
6
Which is better, PHP or Python? Why?
Python . Simple syntax,More readable,General purpose programming language
Kartheek
0 0
5

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

Ask a Question

Related Lessons

A Python Program to calculate Variance and Standard Deviation
Finding the variance and the standard deviation. Variance and Standard Deviation are related measures of dispersion that tell us more about a list of numbers,like are they...


Python Demo
https://www.youtube.com/watch?v=8AEhpZ4lbOI

Python- Basic Concepts part 1
1. What is Python? Python is a high-level programming language, with applications in numerous areas, including web programming, scripting, scientific computing, and artificial intelligence. It is...

map function in python
The function map takes a function and an iterable as arguments and returns a new iterable with the function applied to each argument. Example: def add_five(x): return x+5 nums = result = list(map(add_five,...

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