Python Lab Notes in PowerPoint Presentation

sadete4 13 views 16 slides Apr 26, 2024
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

Python Programming


Slide Content

Intro to python

Print function print function: prints objects- such as text or a number – onto screen or other output devices.

Print(“Hello world”) Print: “Hello W o rld “ and “H e y how are you” in different rows

Where would we use print

Print function: numbers

try P rinting : your age Y our favorite hobby and your favorite TV Show in two separate lines.

Variables and data types

variables

D ata types

practice 1. Create a variable called “course” and assign the name Quantum Computing 2. Create a variable called “age” and assign your age to it. P rint this variable

V ariable naming do’s U se lower case U se underscores to separate words in a variable name E xamples: G rocery_list M y_name city1 V ariable naming dont’s Cannot start with a number Cannot contain spaces Cannot contain special characters Cannot be a Python reserved word like ”with” or ”not”

P rinting variables and strings together

exercise C reate a var called “my_name” and assign your name to it. P rint the sentence “My name is {your name} Solution m y_name= Ben P rint(“My name is “ + my_name)

C reate a var called “class_size” and store the value 10 in it. U sing this variable , print the sentence “Size of class: 10” S olution C lass_size = 10 P rint(“Size of class: “ +str(class_size))

Where you’ll see variables in quantum computing

A rithmic operators
Tags