Introduction Flashcards
What is IEEE Spectrum ?
IEEE Spectrum is the flagship magazine and website of the IEEE - Institute of Electrical and Electronics Engineers
What is a Code ?
The term code refers to anything written in a programming language to provide instructions to a computer
What is Coding?
The term coding is often used to describe the act of writing code.
What is an Code Editor ?
A code editor is an app that lets you type code.
What are the various code editors ?
Anaconda,VS Code Editor ,Pycharm,Jupiter Notebook,
Aptana Studio.
How to start python in VS Code ?
Goto view-Terminal .
How to add two numbers in python Terminal ?
>>> 1+1
2
>>>
How to exit from python terminal in vs code editor?
ctrl + d in Linux ,or exit() or quit() functions.
How to know python version using Linux terminal ?
python –version
or python -V
Which languages supported by jupitor notebook ?
Julia,Python and R,
Julia & R popular for data science
How to get help in python terminal ?
Goto python terminal …
>>> help()
help>
How do get help in the python terminal?
Goto python help terminal…
>>>help()
help>keywords
help>symbols
help>modules
How to exit from help terminal in python ?
ctrl + c and q
How to zoom in out in vs code ?
ctrl + for zoom in
ctrl - for zoom out
How to show aphorisms of python?
Type import this on python interpreter.
Who wrote Zen of Python & how to get them?
The Zen of Python wrote by
Tim Peters.
Type import this on python interpreter.
What are PEP20 in python ?
The Zen of Python is sometimes referred to as PEP 20.The acronym is Python enhancement proposals.
20 refers to the 20 Zen of Python
principles, only 19 of which have been written down.
Where to find peps online ?
Navigate to www.python.org/dev/peps
What is Style Guide for Python Code.
Style Guide for Python Code is an PEP-8,It is all about Python
Coding Style Guidelines from the Python.org website.
https://www.python.org/dev/peps/pep-0008/
What is PyLint ?
PyLint is a tool in Anaconda that makes suggestions about your code
as you’re typing.
How to know installed python modules in anaconda ?
Goto enviroments, see right side pane for installed modules.
They are installed with anaconda.
How to know installed modules using Terminal ?
goto python help and search for modules.
# python
>>>help()
help>modules
What are docstrings in python ?
Multiple line comments enclosed within triple quotation marks are docstrings.
“””
This is an dockstring
“””
How to use python comments ?
Two Methods,
- for single line comments use # symbol.
- for multiline comments use docstrings.
How to import modules in python ?
import modulename
import modulename as alias
import random
import random as rnd
How numbers start in python to store it in variables ?
Number in python should be starts with number 0-9 > 1,10
,decimal sighn > .1 , .326
,or hypen sighn > -22
How many types of python GUI Frameworks ?
- PyQt5
- Tkinter
- Kivy
- wxPython
- Libavg
- PySimpleGUI
- PyForms
- Wax
- PySide2
- PyGui
https: //towardsdatascience.com/top-10-python-gui-frameworks-for-developers-adca32fbe6fc
Using Line Break & semicolon in python ?
You can use line break or semicolon to separate statements.
The code runs the same whether you end each line with a break or a semicolon.
firstName = “Hemant”; lastName = “Kumar”;print(firstName,lastName)
or
firstName = “Hemant”
lastName = “Kumar”
print(firstName,lastName)
How to Print variables in Python ?
name = “Hemant”; age = 32;
print(name,”Age is : “,age)
How to write if else statement in python ?
x = 10
if x==0:
print(“x is Zero”)
else:
print(“Value os x is :”,x)
Explain These Functions?
type()
bin()
max()
min()
type(x) returns datatype of x.
bin(x) returns binary of x
max(x,y,z,..) returns largest value.
min(x,y,z,..) returns minimum value
What is f strings?
Format strings are used to format strings.Used to assighn formated value to variable or in print statement.Format string has two parts ,literal part and expression part.
name = ‘Hemant’
x = f”Name - {name}”
print(x)
username = Hemant
f”Hello {username}”
username = “Alan”
print(f”Hello {username}”)
unit_price = 49.99
quantity = 30
print(f”Subtotal: ${quantity * unit_price}”)
The f before the first quotation mark tells Python that what follows is a format string. Inside the quotation marks, the text, called the literal part, is displayed lit-erally (exactly as typed in the f-string). Anything in curly braces is the expression part of the f-string, a placeholder for what will appear when the code executes.Inside the curly braces, you can have an expression
How to format value in thousand ?
x = 174310.24567
print(f”Total value is Rs.{x:,.2f}”)
How to encased f-strings?
An f-string can be encased in single,double, or triple quotation marks.
x = 12000.345
print(f”Total Value is Rs.{x:,.2f}”)
print(f’Total Value is Rs.{x:,.2f}’)
print(f”"”Total Value is Rs.{x:,.2f}”””)
print(f’'’Total Value is Rs.{x:,.2f}’’’)
How to Format percent numbers?
salesTaxRate = .065
print(f”Sale Tax Rate {salesTaxRate:.2%}”)
Running this code multiples the sales tax rate by 100 and follows it with a % sign,
How to print value of variable with format strings ?
x = 26
print(f”value of x is : {x}”)