stupid coding

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Rewrite the following statements using augmented assignment operators. a. x = x + 1 b. x = x * 2 c. x = x / 10 d. x = x - 100

a. x + = 1 b. x * = 2 c. x / = 10 d. x - = 100

Write a for loop that displays 1, 10,20, 30..1000

for number in range(0, 1001, 10): print(number,' ', end=' ')

Write a set of nested loops that display 10 rows of # characters. There should be 15 # characters in each row.

hashtag=15 for symbol in range(10): for columns in range(hashtag): print('# ', end='') print()

Write code that prompts the user to enter a positive nonzero number and validates the input.

num=int(input("Enter a positive nonzero number")) while num<0: print("error") input("Enter a positive nonzero number")

Write a loop that calculates the total of the following series (1/30+2/29?3/28+....30/1)

sum=0 for number in range(1,31): sum+=number/(31-number) print('1/30+2/29+3/28+...30/1=', sum)


Set pelajaran terkait

EMT chapter 9 quiz - patient assessment

View Set

NSSW NEXT: SERVICE RECEPTION & WRITE-UP

View Set

french 2 exam (fill in the proper form of the listed verb)

View Set

**Chapter 24** Digestive System (STR**)

View Set