Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ex03.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@
print("It is greater?", 5 > -2)
print("It is greater or equal?", 5 >= -2)
print("It is less or equal?", 5 <= -2)



# Notice the math seems “wrong”? There are no fractions, only whole numbers.
# yes the maths is wrong.
# floating number i read.





8 changes: 8 additions & 0 deletions ex04.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@
print("We can transport", carpool_capacity, "people today.")
print("We have", passengers, "to carpool today.")
print("We need to put about", average_passengers_per_car, "in each car.")

# What do you mean by “read the file backward”?
#Very simple. Imagine you have a fi le with 16 lines of code in it. Start at line 16, and compare it to
# my file at line 16. Then do it again for 15, and so on, until you’ve read the whole fi le backward.

#Why does / (divide) round down?
#It’s not really rounding down; it’s just dropping the fractional part after the decimal. Try doing
#7.0 / 4.0 and compare it to 7 / 4 and you’ll see the difference.
16 changes: 16 additions & 0 deletions ex11.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,19 @@
weight = input()

print(f"So, you're {age} old, {height} tall and {weight} heavy.")


# Below is the output where I gave input as string and number.
# input() take as string and then we have to convert it to integer but here we are not converting.

# jas@jasmeen-E490:~$ /usr/bin/python3 /home/jas/Downloads/ex1.py
# How old are you? two
# How tall are you? two
# How much do you weight? two
# So, you're two old, two tall and two heavy.

# jas@jasmeen-E490:~$ /usr/bin/python3 /home/jas/Downloads/ex1.py
# How old are you? 33
# How tall are you? 5.5
# How much do you weight? 65
# So, you're 33 old, 5.5 tall and 65 heavy.
36 changes: 36 additions & 0 deletions ex13.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,39 @@
print("Your first variable is:", first)
print("Your second variable is:", second)
print("Your third variable is:", third)

# in below script, I dont understand how come ex1.py came in place of script. why not scripts

# jas@jasmeen-E490:~/Downloads$ python3 ex1.py first second third
# The script is called: ex1.py
# Your first variable is: first
# Your second variable is: second
# Your third variable is: third

#################################################################

# in below script i tried giving argv as input from user but why the output is not number in line 43, 44, 45

# from sys import argv


# age = input("How old are you? ")
# height = input("How tall are you? ")
# weight = input("How much do you weight? ")


# script, age, height, weight = argv

# print("The script is called:", script)
# print("Your age is:", age)
# print("Your height is:", height)
# print("Your weight is:", weight)

# jas@jasmeen-E490:~/Downloads$ python3 ex1.py age height weight
# How old are you? 33
# How tall are you? 5.6
# How much do you weight? 65
# The script is called: ex1.py
# Your age is: age
# Your height is: height
# Your weight is: weight