0% found this document useful (0 votes)
3 views2 pages

Basic Python

GDB Online is a versatile online compiler and debugger for multiple programming languages, allowing users to code, compile, run, and debug from anywhere. The document provides a brief introduction to Python programming, covering topics such as variables, data types, input/output basics, string manipulation, and type conversions. It includes examples of syntax for printing, variable assignments, and operations on strings.

Uploaded by

indigalakishore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Basic Python

GDB Online is a versatile online compiler and debugger for multiple programming languages, allowing users to code, compile, run, and debug from anywhere. The document provides a brief introduction to Python programming, covering topics such as variables, data types, input/output basics, string manipulation, and type conversions. It includes examples of syntax for printing, variable assignments, and operations on strings.

Uploaded by

indigalakishore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

'''

Welcome to GDB Online.


GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP,
Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS,
JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

'''
#Python
#python is a programmimg language
#programming means set of instructions send to hardware
#python is a versatile language
#versatile means it almost every field
#how to print hello world in python
#syntax
print("hello world")
#variables and datatypes
#variables are like containers to store values
#every value is a type of data
#we have different types of datatypes
#1.string
#2.int
#3.float
#4.bool
# string means sequence of characters it enclosed with single quotes or double
quotes
# capital letters
# small letters
# digits
# spaces and special characters and symbols
a="kishore"
print(a)
a="123"
print(a)
a="$#% *()"
print(a)
#int means whole numbers and natural numbers
#0-9 or 1-9
a=1
print(1)
#float means it stores decimal values
a=3.123
print(a)
#bool means it stores true or false datatype
a=True
print(a)
a=False
print(a)
#sequence of instructions
#in python it reads like sequence
a="kishore"
a="JP"
print(a)
#input output basics
#user taken input it reads like string
a=input()#input reads like string
print(a)
#string concatination
#joining/added together strings is called string concatination.here uses +
operator
a=input()
b=input()
print(a+" "+b)
#string repitation uses * operator
a=input()
print((a+" ")*2)
#length of string
a="kishore"
b=len(a)
print(b)
#accessing characters to strings
#we can access every character to string by using index
#index starts from 0
#syntax var[index]
#ex:kishore is a string index statrs from 0
#this string starts 0,1,2,3,4,5,6
a=input()
b=a[2]
print(b)
#string slicing
#obtaining a part in the string is called string slicing
#syntax var[start:end]
#note end is not included
a=input()
b=a[0:3]
print(b)
#type conversions
#to convert one datatype to another data type is called type conversion
# 1.str()
# 2.int()
# 3.float()
# 4.bool()
#int conversion
a=3.123
b=int(a)
print(a)
#float conversion
a=123
b=float(a)
print(b)
#bool conversion
c="True"
d=bool(c)
print(c)
#string conversion
a=123
b=str(a)
print(b)
#while conver string to int or float
#string must be in digits
#we can check the datatype by using type()
a=123
b=str(a)
c=type(b)
print(c)

You might also like