How do you print 2 functions next to each other? [duplicate] - python

This question already has answers here:
How can strings be concatenated?
(7 answers)
String formatting in Python [duplicate]
(14 answers)
Closed 8 months ago.
import webbrowser
import random
idr = random.randint(10000, 9999999)
link = 'view&id='
webbrowser.open(link,idr)
with this code it generates the id and puts it at the end of the link as an id for an image however i have found that it wont work as it puts a space between the links = and the id

Related

Why is there no output in this function/parameter? [duplicate]

This question already has answers here:
Why doesn't Python print return values?
(3 answers)
Function in Python not producing output? [duplicate]
(4 answers)
What is the purpose of the return statement? How is it different from printing?
(15 answers)
Closed 2 months ago.
def plus_ten(a):
return a + 10
plus_ten(2)
I thought that the plus_ten(2) would generate an output of 12, but when I run the code, it comes up with nothing.
Why is this?
This was lifted directly from: https://www.youtube.com/watch?v=lA9OuhldJd0&ab_channel=365DataScience
It shows in the video that there should be an output. However, in my VS studio, there is no output... please help!

How to get the number of letters of a word in python? [duplicate]

This question already has answers here:
How to get the size of a string in Python?
(6 answers)
Closed 1 year ago.
This is what have tried but it's not working
lens("Father")
it's len('Father') not lens('Father')
len(Father)
Your mistake is the 's' at the end of len's'

I'm trying to append to a list in python but it gives back a NoneType [duplicate]

This question already has answers here:
Why does "x = x.append(...)" not work in a for loop?
(8 answers)
Closed 2 years ago.
This is my code but my output gives a none type back and not a list full of numbers.
PHC=[]
for i in range(len(df)):
x=df['HC'][0:i+1].mean()
PHC=PHC.append(x)
len[df]['HC']
instead of
len[df]

Python counting next to one another [duplicate]

This question already has answers here:
How to print without a newline or space
(26 answers)
Closed 5 years ago.
I have this code but i would like the numbers to be printed next to one another but it doesn't do that it just prints down the screen instead of filling up the screen.
import random
count=2
while count>0:
print(random.randint(0,1))
replace
print(random.randint(0,1))
with
print(random.randint(0,1), end="").
See https://docs.python.org/3/tutorial/inputoutput.html

How do i make random letter from a string? [duplicate]

This question already has answers here:
Generate a random letter in Python
(23 answers)
Closed 5 years ago.
In python I want to know how to get random letter from string.
eg.
randomize("HELLO")
returns "L"
return (random.choice(string))

Categories