Python

Numeric conversions and creation of complex number

  • We can able to convert from one numeric form to other numeric form.
  • The following are the different conversions
  • Integer to float conversion
  • Float to integer conversion
  • Integer to complex
  • Complex to integer

Integer to float conversion

Example

a=5

b= float(a)

print(b)

output:

5.0

Float to integer conversion

example

a=5.5

b= int(a)

print(b)

Output:  5

Integer to complex

Example:

a=5

b= complex(a)

print(b)

output:

(5+0j)

How to Create complex  number?

The following is the way to create a complex number.

a=5

b=6

c=complex(a,b)

print(c)

output:

(5+6j)

Boolean

  • In python Boolean represents true or false
  • The following example represents  how boolean type works
a=10

b=20

a<b

output: True

In python true is represented by 1 and false is represented by 0.

>>int (True)

Ans:1

>>Int(false)

Ans:0

Lakshmi Durga

Share
Published by
Lakshmi Durga

Recent Posts

Samsung TV Red Light Blinking? 4 Fixes (2026 Power Logic Hub)

User Problem Scenario: The Red Light "Panic" You press the power button on your Samsung…

5 days ago

Samsung TV Not Connecting to WiFi: 2026 Easy Fix Guide

Introduction: I Know the Feeling "We’ve all been there. You sit down to watch your…

6 days ago

Samsung TV Restarting During Diagnosis? Fix the Reboot Loop Fast

User Problem Scenario: The "Diagnosis Loop" Paradox Imagine you notice your apps are slow. You…

6 days ago

Samsung TV Optimize Now Not Working? (2026 Fix: Greyed Out, Stuck or Not Responding)

🎓 Technical Module: Memory Maintenance Logic Module: WV-OS-307 Verified 2026 👨‍🏫 Instructor: Vangari Divya (M.Tech)…

1 week ago

Samsung Smart Hub Test Failed? (2026 Fix: DNS, ISP Block & Authentication Error)

 Introduction: The Setup Paradox "There is a specific moment of frustration for every Samsung Smart…

2 weeks ago

Samsung TV Picture Test Not Working? 4 Technical Recovery Fixes

Introduction: Lab Diary & Experience "When your Samsung TV screen begins to flicker or show…

2 weeks ago